Changeset 562
- Timestamp:
- Jun 29, 2021, 10:23:44 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/Changelog
r560 r562 1 4.4.4: 2 * fix more gcc 10 compiler warnings 3 * fix bug with signify-openbsd in client/server setup (reported 4 by Sdoba) 5 1 6 4.4.3: 2 7 * allow console logging to a unix domain socket -
trunk/src/dnmalloc.c
r520 r562 165 165 * HAVE_SYS_PARAM_H Define to #include <sys/param.h> (for pagesize) 166 166 * 167 * HAVE_MALLOC_H Define to #include <malloc.h> (for struct mallinfo )167 * HAVE_MALLOC_H Define to #include <malloc.h> (for struct mallinfo2) 168 168 * 169 169 * HAVE_FCNTL_H Define to #include <fcntl.h> … … 531 531 #define vALLOc public_vALLOc 532 532 #define pVALLOc public_pVALLOc 533 #define mALLINFo public_mALLINFo533 #define mALLINFo2 public_mALLINFo2 534 534 #define mALLOPt public_mALLOPt 535 535 #define mTRIm public_mTRIm … … 547 547 #define public_vALLOc dlvalloc 548 548 #define public_pVALLOc dlpvalloc 549 #define public_mALLINFo dlmallinfo549 #define public_mALLINFo2 dlmallinfo2 550 550 #define public_mALLOPt dlmallopt 551 551 #define public_mTRIm dlmalloc_trim … … 561 561 #define public_vALLOc valloc 562 562 #define public_pVALLOc pvalloc 563 #define public_mALLINFo mallinfo563 #define public_mALLINFo2 mallinfo2 564 564 #define public_mALLOPt mallopt 565 565 #define public_mTRIm malloc_trim … … 791 791 792 792 /* 793 This version of malloc supports the standard SVID/XPG mallinfo 793 This version of malloc supports the standard SVID/XPG mallinfo2 794 794 routine that returns a struct containing usage properties and 795 795 statistics. It should work on any SVID/XPG compliant system that has 796 a /usr/include/malloc.h defining struct mallinfo . (If you'd like to796 a /usr/include/malloc.h defining struct mallinfo2. (If you'd like to 797 797 install such a thing yourself, cut out the preliminary declarations 798 798 as described above and below and save them in a malloc.h file. But 799 799 there's no compelling reason to bother to do this.) 800 800 801 The main declaration needed is the mallinfo struct that is returned802 (by-copy) by mallinfo (). The SVID/XPG malloinfostruct contains a801 The main declaration needed is the mallinfo2 struct that is returned 802 (by-copy) by mallinfo2(). The SVID/XPG malloinfo2 struct contains a 803 803 bunch of fields that are not even meaningful in this version of 804 malloc. These fields are are instead filled by mallinfo () with804 malloc. These fields are are instead filled by mallinfo2() with 805 805 other numbers that might be of interest. 806 806 807 807 HAVE_MALLOC_H should be set if you have a 808 808 /usr/include/malloc.h file that includes a declaration of struct 809 mallinfo . If so, it is included; else an SVID2/XPG2 compliant809 mallinfo2. If so, it is included; else an SVID2/XPG2 compliant 810 810 version is declared below. These must be precisely the same for 811 mallinfo () to work. The original SVID version of this struct,812 defined on most systems with mallinfo , declares all fields as813 ints. But some others define as unsigned long. If your system811 mallinfo2() to work. The original SVID version of this struct, 812 defined on most systems with mallinfo2, declares all fields as 813 size_2. But some others define as unsigned long. If your system 814 814 defines the fields using a type of different width than listed here, 815 815 you must #include your system version and #define … … 826 826 #else 827 827 828 /* SVID2/XPG mallinfo structure */829 830 struct mallinfo {831 int arena; /* non-mmapped space allocated from system */832 int ordblks; /* number of free chunks */833 int smblks; /* number of fastbin blocks */834 int hblks; /* number of mmapped regions */835 int hblkhd; /* space in mmapped regions */836 int usmblks; /* maximum total allocated space */837 int fsmblks; /* space available in freed fastbin blocks */838 int uordblks; /* total allocated space */839 int fordblks; /* total free space */840 int keepcost; /* top-most, releasable (via malloc_trim) space */828 /* SVID2/XPG mallinfo2 structure */ 829 830 struct mallinfo2 { 831 size_t arena; /* non-mmapped space allocated from system */ 832 size_t ordblks; /* number of free chunks */ 833 size_t smblks; /* number of fastbin blocks */ 834 size_t hblks; /* number of mmapped regions */ 835 size_t hblkhd; /* space in mmapped regions */ 836 size_t usmblks; /* maximum total allocated space */ 837 size_t fsmblks; /* space available in freed fastbin blocks */ 838 size_t uordblks; /* total allocated space */ 839 size_t fordblks; /* total free space */ 840 size_t keepcost; /* top-most, releasable (via malloc_trim) space */ 841 841 }; 842 842 … … 1008 1008 1009 1009 /* 1010 mallinfo ()1010 mallinfo2() 1011 1011 Returns (by copy) a struct containing various summary statistics: 1012 1012 … … 1031 1031 */ 1032 1032 #if __STD_C 1033 struct mallinfo public_mALLINFo(void);1034 #else 1035 struct mallinfo public_mALLINFo();1033 struct mallinfo2 public_mALLINFo2(void); 1034 #else 1035 struct mallinfo2 public_mALLINFo2(); 1036 1036 #endif 1037 1037 … … 1115 1115 1116 1116 malloc_stats prints only the most commonly interesting statistics. 1117 More information can be obtained by calling mallinfo .1117 More information can be obtained by calling mallinfo2. 1118 1118 1119 1119 */ … … 1366 1366 static void mSTATs(); 1367 1367 static int mALLOPt(int, int); 1368 static struct mallinfo mALLINFo(void);1368 static struct mallinfo2 mALLINFo2(void); 1369 1369 #else 1370 1370 static Void_t* mALLOc(); … … 1380 1380 static void mSTATs(); 1381 1381 static int mALLOPt(); 1382 static struct mallinfo mALLINFo();1382 static struct mallinfo2 mALLINFo2(); 1383 1383 #endif 1384 1384 … … 1687 1687 } 1688 1688 1689 struct mallinfo public_mALLINFo() {1690 struct mallinfo m;1689 struct mallinfo2 public_mALLINFo2() { 1690 struct mallinfo2 m; 1691 1691 if (MALLOC_PREACTION == 0) { 1692 m = mALLINFo ();1692 m = mALLINFo2(); 1693 1693 (void) MALLOC_POSTACTION; 1694 1694 return m; 1695 1695 } else { 1696 struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };1696 struct mallinfo2 nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; 1697 1697 return nm; 1698 1698 } … … 5293 5293 */ 5294 5294 5295 DL_STATIC struct mallinfo mALLINFo()5295 DL_STATIC struct mallinfo2 mALLINFo2() 5296 5296 { 5297 5297 mstate av = get_malloc_state(); 5298 static struct mallinfo mi;5298 static struct mallinfo2 mi; 5299 5299 unsigned int i; 5300 5300 mbinptr b; … … 5361 5361 DL_STATIC void mSTATs() 5362 5362 { 5363 struct mallinfo mi = mALLINFo();5363 struct mallinfo2 mi = mALLINFo2(); 5364 5364 5365 5365 fprintf(stderr, "hashtable = %10lu MB\n", -
trunk/src/sh_login_track.c
r541 r562 402 402 while(u) 403 403 { 404 if (0 == s trcmp(user, u->user))404 if (0 == sl_strcmp(user, u->user)) 405 405 { 406 406 return u; … … 839 839 else 840 840 { 841 q = strchr(host, '.'); 841 char * tmp = sh_util_strdup(host); 842 q = strchr(tmp, '.'); 842 843 if (q && *q) 843 844 { 844 845 ++q; 845 846 p = sh_util_strdup(q); 847 SH_FREE(tmp); 846 848 } 847 849 else 848 850 { 849 p = sh_util_strdup(host);851 p = tmp; 850 852 } 851 853 } -
trunk/src/sh_tools.c
r550 r562 1386 1386 } 1387 1387 1388 #ifdef SH_ENCRYPT 1388 1389 static int probe_ok(int flag) 1389 1390 { … … 1393 1394 return S_FALSE; 1394 1395 } 1396 #endif 1395 1397 1396 1398 static unsigned char probe_header_set(unsigned char protocol) … … 1444 1446 } 1445 1447 1448 #ifdef SH_ENCRYPT 1446 1449 static int probe_ok(int flag) 1447 1450 { … … 1450 1453 return S_FALSE; 1451 1454 } 1455 #endif 1456 1452 1457 #endif 1453 1458 -
trunk/src/t-test0.c
r541 r562 390 390 actions = RANDOM(&ld, ACTIONS_MAX); 391 391 #if USE_MALLOC && MALLOC_DEBUG 392 if(actions < 2) { mallinfo (); }392 if(actions < 2) { mallinfo2(); } 393 393 #endif 394 394 for(j=0; j<actions; j++) { -
trunk/src/t-test1.c
r481 r562 499 499 actions = RANDOM(&ld, ACTIONS_MAX); 500 500 #if USE_MALLOC && MALLOC_DEBUG 501 if(actions < 2) { mallinfo (); }501 if(actions < 2) { mallinfo2(); } 502 502 #endif 503 503 for(j=0; j<actions; j++) { -
trunk/src/yulectl.c
r481 r562 48 48 #endif 49 49 50 #define SH_PW_SIZE 15 51 50 52 static int sock = -1; 51 static char password[ 15] = "";53 static char password[SH_PW_SIZE] = ""; 52 54 static int verbose = 0; 53 55 … … 123 125 static char * safe_copy(char * to, const char * from, size_t size) 124 126 { 125 if (to && from) 126 { 127 strncpy (to, from, size); 128 if (size > 0) 129 to[size-1] = '\0'; 130 else 131 *to = '\0'; 127 if (to && from && (size > 0)) 128 { 129 strncpy (to, from, size-1); 130 to[size-1] = '\0'; 132 131 } 133 132 return to; … … 144 143 */ 145 144 name.sun_family = AF_UNIX; 146 strncpy (name.sun_path, serversock, sizeof(name.sun_path) - 1); 145 memcpy(name.sun_path, serversock, sizeof(name.sun_path)); 146 name.sun_path[sizeof(name.sun_path)-1] = '\0'; 147 if (strlen(serversock) > strlen(name.sun_path)) 148 { 149 perror (_("ERROR: socket path too long")); 150 return -1; 151 } 147 152 size = (offsetof (struct sockaddr_un, sun_path) 148 153 + strlen (name.sun_path) + 1); … … 401 406 */ 402 407 pw = getenv(_("YULECTL_PASSWORD")); 403 if (pw && strlen(pw) < 15)408 if (pw && strlen(pw) < SH_PW_SIZE) 404 409 { 405 410 strcpy(password, pw); … … 413 418 return -1; 414 419 415 if ( (strlen(home) + strlen(_("/.yulectl_cred")) + 1) > 4096)420 if ( (strlen(home) + strlen(_("/.yulectl_cred")) + 1) > sizeof(home)) 416 421 { 417 422 fprintf (stderr, "%s", _("ERROR: path for $HOME is too long.\n")); … … 451 456 (void) rtrim(message2); 452 457 453 if (strlen(message2) > 14)458 if (strlen(message2) > (SH_PW_SIZE -1)) 454 459 { 455 460 fprintf (stderr, "%s", -
trunk/test/testrun_1b.sh
r539 r562 239 239 do_test_1b_2 () { 240 240 241 rm -f $PW_DIR/test_log_prelude 242 243 [ -z "$verbose" ] || { echo " starting prelude-manager.."; echo " ($PM --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 &)"; } 244 "$PM" --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 & 245 PID=$! 246 247 five_sec_sleep 241 #rm -f $PW_DIR/test_log_prelude 242 test_log_prelude="/var/log/prelude/prelude-text.log" 243 echo -n >"${test_log_prelude}" 244 245 #[ -z "$verbose" ] || { echo " starting prelude-manager.."; echo " ($PM --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 &)"; } 246 #"$PM" --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 & 247 #PID=$! 248 249 #five_sec_sleep 248 250 249 251 ./samhain -t check -p none -l info --set-prelude-severity=info --prelude --server-addr 127.0.0.1:5500 >/dev/null … … 259 261 else 260 262 [ -z "$quiet" ] && log_msg_fail "check..."; 261 kill $PID263 #kill $PID 262 264 return 1 263 265 fi 264 266 # 265 tmp=`egrep 'File original:.*name=etc.*path=/etc' test_log_prelude2>/dev/null | wc -l`267 tmp=`egrep 'File original:.*name=etc.*path=/etc' ${test_log_prelude} 2>/dev/null | wc -l` 266 268 if [ $tmp -lt 1 ]; then 267 269 [ -z "$verbose" ] || log_msg_fail "/etc"; 268 kill $PID269 return 1 270 fi 271 tmp=`egrep 'Classification text: Checking' test_log_prelude2>/dev/null | wc -l`270 #kill $PID 271 return 1 272 fi 273 tmp=`egrep 'Classification text: Checking' ${test_log_prelude} 2>/dev/null | wc -l` 272 274 if [ $tmp -lt 1 ]; then 273 275 [ -z "$verbose" ] || log_msg_fail "checking"; 274 kill $PID276 #kill $PID 275 277 return 1 276 278 fi 277 279 # 278 280 if test "x$2" = "xmodrc"; then 279 tmp=`egrep 'Classification text: Service opened' test_log_prelude2>/dev/null | wc -l`281 tmp=`egrep 'Classification text: Service opened' ${test_log_prelude} 2>/dev/null | wc -l` 280 282 if [ $tmp -lt 1 ]; then 281 283 [ -z "$verbose" ] || log_msg_fail "service"; 282 kill $PID283 return 1 284 fi 285 tmp=`egrep 'Service: port=5500' test_log_prelude2>/dev/null | wc -l`284 #kill $PID 285 return 1 286 fi 287 tmp=`egrep 'Service: port=5500' ${test_log_prelude} 2>/dev/null | wc -l` 286 288 if [ $tmp -lt 1 ]; then 287 289 [ -z "$verbose" ] || log_msg_fail "port 5500"; 288 kill $PID290 #kill $PID 289 291 return 1 290 292 fi 291 293 fi 292 294 # 293 kill $PID295 #kill $PID 294 296 return 0 295 297 } -
trunk/test/testrun_1e.sh
r468 r562 25 25 MAXTEST=5; export MAXTEST 26 26 27 test_log_prelude="/var/log/prelude/prelude-text.log"; export test_log_prelude 28 27 29 PORTPOLICY_5=" 28 30 [ReadOnly] … … 42 44 log_skip 5 $MAXTEST 'logging to prelude (or use --really-all)' 43 45 else 44 tmp=`egrep 'Service: port=5500 .unknown. protocol=tcp' test_log_prelude2>/dev/null | wc -l`46 tmp=`egrep 'Service: port=5500 .unknown. protocol=tcp' ${test_log_prelude} 2>/dev/null | wc -l` 45 47 if [ $tmp -lt 1 ]; then 46 48 [ -z "$verbose" ] || log_msg_fail "port 5500"; … … 187 189 run_check_prelude() 188 190 { 191 echo -n >"${test_log_prelude}" 192 189 193 ./samhain -t check -p none -l info --set-prelude-severity=info --prelude --server-addr 127.0.0.1:5500 >/dev/null 190 194 … … 322 326 # 323 327 # 324 [ -z "$verbose" ] || { echo " starting prelude-manager.."; echo " ($PM --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 &)"; }325 "$PM" --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 &326 PRELUDEPID=$!328 #[ -z "$verbose" ] || { echo " starting prelude-manager.."; echo " ($PM --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 &)"; } 329 #"$PM" --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 & 330 #PRELUDEPID=$! 327 331 # 328 332 # -
trunk/test/testrun_2d.sh
r481 r562 38 38 # PGPASSWORD=samhain; export PGPASSWORD 39 39 create_pgpass 40 psql - o test_log_db -U samhain -d samhain -c "SELECT * FROM log WHERE entry_status = 'NEW' and log_time > '${DATE}';"40 psql -h localhost -o test_log_db -U samhain -d samhain -c "SELECT * FROM log WHERE entry_status = 'NEW' and log_time > '${DATE}';" 41 41 # 42 42 egrep "START.*Yule" test_log_db >/dev/null 2>&1 43 43 if [ $? -ne 0 ]; then 44 [ -z "$verbose" ] || log_msg_fail "Server start (psql) ";44 [ -z "$verbose" ] || log_msg_fail "Server start (psql) DATE ${DATE}"; 45 45 return 1 46 46 fi … … 88 88 # PGPASSWORD="samhain"; export PGPASSWORD 89 89 create_pgpass 90 TEST=`psql - U samhain -d samhain -c "SELECT * FROM log LIMIT 1;" 2>/dev/null`90 TEST=`psql -h localhost -U samhain -d samhain -c "SELECT * FROM log LIMIT 1;" 2>/dev/null` 91 91 if [ $? -ne 0 -o -z "$TEST" ]; then 92 92 log_skip 1 $MAXTEST "psql not default setup" … … 112 112 ORIGINAL="DatabaseSeverity=none" 113 113 REPLACEMENT="DatabaseSeverity=info" 114 ex -s $RCFILE <<EOF 115 %s/$ORIGINAL/$REPLACEMENT/g 116 wq 117 EOF 118 # 119 ORIGINAL="# setdbname=samhain" 120 REPLACEMENT="setdbhost=127.0.0.1" 114 121 ex -s $RCFILE <<EOF 115 122 %s/$ORIGINAL/$REPLACEMENT/g
Note:
See TracChangeset
for help on using the changeset viewer.