- Timestamp:
- Apr 18, 2009, 5:55:37 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r225 r226 12 12 dnl start 13 13 dnl 14 AM_INIT_AUTOMAKE(samhain, 2.5. 4)14 AM_INIT_AUTOMAKE(samhain, 2.5.5) 15 15 AC_DEFINE([SAMHAIN], 1, [Application is samhain]) 16 16 AC_CANONICAL_HOST -
trunk/docs/Changelog
r225 r226 1 2.5.4: 1 2.5.5: 2 * fix for incorrect handling of hostnames in database insertion 3 (reported by byron) 4 5 2.5.4 (04-03-2009): 2 6 * fix for incorrect input check in SRP implementation (discovered 3 7 by Thomas Ptacek) -
trunk/src/sh_database.c
r207 r226 1766 1766 /* recursively enter linked list of messages into database, last first 1767 1767 */ 1768 long sh_database_insert_rec (dbins * curr, int depth )1768 long sh_database_insert_rec (dbins * curr, int depth, char * host) 1769 1769 { 1770 1770 unsigned long id = 0; 1771 dbins * prev;1772 1771 1773 1772 SL_ENTER(_("sh_database_insert_rec")); … … 1775 1774 if (curr->next) 1776 1775 { 1776 /* 1777 1777 prev = curr->next; 1778 1778 sl_strlcpy(prev->host, curr->host, 64); 1779 1779 id = sh_database_insert_rec (curr->next, (depth + 1)); 1780 } 1780 */ 1781 ++depth; 1782 id = sh_database_insert_rec (curr->next, depth, curr->host); 1783 } 1784 1785 if (host) 1786 sl_strlcpy(curr->host, host, 64); 1781 1787 1782 1788 if (id != 0) /* this is a server wrapper */ … … 1818 1824 /* recursively enter the linked list into the database 1819 1825 */ 1820 (void) sh_database_insert_rec (db_entry, 0 );1826 (void) sh_database_insert_rec (db_entry, 0, NULL); 1821 1827 1822 1828 SL_RETURN(0, _("sh_database_insert")); -
trunk/src/sh_utils.c
r214 r226 2107 2107 2108 2108 2109 size_t sh_util_base64_enc (unsigned char * out, const unsigned char * instr, 2109 size_t sh_util_base64_enc (unsigned char * out, 2110 const unsigned char * instr, 2110 2111 size_t lin) 2111 2112 { … … 2171 2172 } 2172 2173 2173 size_t sh_util_base64_dec (unsigned char *out, const unsigned char *in, 2174 size_t sh_util_base64_dec (unsigned char *out, 2175 const unsigned char *in, 2174 2176 size_t lin) 2175 2177 { -
trunk/test/testrun_2a.sh
r207 r226 229 229 chmod 644 ./rc.${ALTHOST} 230 230 chmod 644 ./file.${ALTHOST} 231 232 echo $SHPW > ./testpw 231 233 } 232 234 -
trunk/test/testrun_2c.sh
r100 r226 19 19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 20 # 21 LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE 22 RCFILE="$PW_DIR/testrc_2"; export RCFILE 23 HTML="$PW_DIR/yule.html"; export HTML 21 24 22 25 SERVER_BUILDOPTS="--quiet $TRUST --enable-xml-log --enable-debug --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST} --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-database=mysql"; export SERVER_BUILDOPTS … … 24 27 CLIENT_BUILDOPTS="--quiet $TRUST --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS 25 28 26 MAXTEST=3; export MAXTEST 29 MAXTEST=4; export MAXTEST 30 31 do_test_1_c () { 32 33 [ -z "$verbose" ] || { 34 echo; 35 echo "${S}Start Server${E}: ./yule -l info -p none &"; 36 echo; 37 } 38 39 rm -f test_log_valgrind 40 41 ${VALGRIND} ./yule.2 -q -l info -p none >/dev/null 2>>test_log_valgrind & 42 PROC_Y2=$! 43 five_sec_sleep 44 45 [ -z "$verbose" ] || { 46 echo; 47 echo "${S}Start Server #2${E}: ./yule.2 -l info -p none &"; 48 echo; 49 } 50 51 ${VALGRIND} ./yule -l info -p none -e info --bind-address=127.0.0.1 \ 52 --server-port=49778 >/dev/null 2>>test_log_valgrind & 53 PROC_Y=$! 54 five_sec_sleep 55 56 [ -z "$verbose" ] || { 57 echo; 58 echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check"; 59 echo; 60 } 61 62 ${VALGRIND} ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 >/dev/null 2>>test_log_valgrind 63 if test x$? = x0; then 64 [ -z "$verbose" ] || log_msg_ok "samhain.new -t check"; 65 else 66 [ -z "$quiet" ] && log_msg_fail "samhain.new -t check"; 67 kill $PROC_Y 68 kill $PROC_Y2 69 return 1 70 fi 71 72 kill $PROC_Y 73 kill $PROC_Y2 74 five_sec_sleep 75 76 # cp ${LOGFILE} triple_test 77 # cp ${LOGFILE}2 triple_test_2 78 79 egrep "START(>|\").*Yule(>|\")" ${LOGFILE}2 >/dev/null 2>&1 80 if [ $? -ne 0 ]; then 81 [ -z "$verbose" ] || log_msg_fail "Server #2 start"; 82 return 1 83 fi 84 egrep "remote_host.*Checking.*/bin" ${LOGFILE}2 >/dev/null 2>&1 85 if [ $? -ne 0 ]; then 86 [ -z "$verbose" ] || log_msg_fail "Client file check (relayed)"; 87 return 1 88 fi 89 egrep "remote_host.*EXIT.*Samhain" ${LOGFILE}2 >/dev/null 2>&1 90 if [ $? -ne 0 ]; then 91 [ -z "$verbose" ] || log_msg_fail "Client exit (relayed)"; 92 return 1 93 fi 94 egrep "EXIT.*Yule.*SIGTERM" ${LOGFILE}2 >/dev/null 2>&1 95 if [ $? -ne 0 ]; then 96 [ -z "$verbose" ] || log_msg_fail "Server #2 exit"; 97 return 1 98 fi 99 100 101 egrep "START(>|\").*Yule(>|\")" $LOGFILE >/dev/null 2>&1 102 if [ $? -ne 0 ]; then 103 [ -z "$verbose" ] || log_msg_fail "Server start"; 104 return 1 105 fi 106 egrep "NEW CLIENT" $LOGFILE >/dev/null 2>&1 107 if [ $? -ne 0 ]; then 108 [ -z "$verbose" ] || log_msg_fail "Client connect"; 109 return 1 110 fi 111 egrep "remote_host.*Checking.*/bin" $LOGFILE >/dev/null 2>&1 112 if [ $? -ne 0 ]; then 113 [ -z "$verbose" ] || log_msg_fail "Client file check"; 114 return 1 115 fi 116 egrep "remote_host.*EXIT.*Samhain" $LOGFILE >/dev/null 2>&1 117 if [ $? -ne 0 ]; then 118 [ -z "$verbose" ] || log_msg_fail "Client exit"; 119 return 1 120 fi 121 egrep "EXIT.*Yule.*SIGTERM" $LOGFILE >/dev/null 2>&1 122 if [ $? -ne 0 ]; then 123 [ -z "$verbose" ] || log_msg_fail "Server exit"; 124 return 1 125 fi 126 127 [ -z "$VALGRIND" ] || { 128 tmp=`cat test_log_valgrind 2>/dev/null | wc -l`; 129 if [ $tmp -ne 0 ]; then 130 [ -z "$verbose" ] || log_msg_fail "valgrind reports errors"; 131 cat test_log_valgrind 132 return 1; 133 fi; 134 } 135 136 return 0 137 } 27 138 28 139 testrun_threesockets () { … … 152 263 testrun2a_internal 153 264 # 265 # BUILD Server 2 266 # 267 cp ./yule ./yule.orig 268 269 ${TOP_SRCDIR}/configure --quiet $TRUST --enable-debug --enable-network=server --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=${RCFILE}2 --with-log-file=${LOGFILE}2 --with-pid-file=$PW_DIR/.samhain_lock2 --with-html-file=${HTML}2 --with-state-dir=$PW_DIR --with-port=49778 --with-database=mysql 270 # 271 if test x$? = x0; then 272 [ -z "$verbose" ] || log_msg_ok "configure..."; 273 $MAKE > /dev/null 2>>test_log 274 if test x$? = x0; then 275 [ -z "$verbose" ] || log_msg_ok "make..."; 276 else 277 [ -z "$quiet" ] && log_msg_fail "make..."; 278 return 1 279 fi 280 281 else 282 [ -z "$quiet" ] && log_msg_fail "configure..."; 283 return 1 284 fi 285 286 cp yule yule.2 || return 1 287 # 288 cp ./yule.orig ./yule 289 # 290 SHPW=`cat ./testpw` 291 292 if test x"$SHPW" = x; then 293 [ -z "$quiet" ] && log_msg_fail "password not generated -- aborting" 294 return 1 295 fi 296 297 rm -f ./testpw 298 299 ./samhain_setpwd yule new $SHPW >/dev/null 300 301 if test x$? = x0; then 302 [ -z "$verbose" ] || log_msg_ok "./samhain_setpwd yule new $SHPW"; 303 else 304 [ -z "$quiet" ] && log_msg_fail "./samhain_setpwd yule new $SHPW"; 305 return 1 306 fi 307 308 309 $MAKE clean >/dev/null || return 1 310 mv yule.new yule || return 1 311 # 154 312 ORIGINAL="DatabaseSeverity=none" 155 313 REPLACEMENT="DatabaseSeverity=info" … … 160 318 # 161 319 do_test_1_a 320 # 162 321 if [ $? -ne 0 ]; then 163 322 [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client/server w/mysql"; … … 171 330 fi 172 331 fi 332 # 333 cp testrc_2 testrc_22 334 ORIGINAL="DatabaseSeverity=none" 335 REPLACEMENT="DatabaseSeverity=info" 336 ex -s $RCFILE <<EOF 337 %s/$REPLACEMENT/$ORIGINAL/g 338 wq 339 EOF 340 # 341 do_test_1_c 342 # 343 if [ $? -ne 0 ]; then 344 [ -z "$quiet" ] && log_fail 2 ${MAXTEST} "Client/server (relay) w/mysql"; 345 else 346 # 347 check_mysql_log "${DATE}" 348 if [ $? -ne 0 ]; then 349 [ -z "$quiet" ] && log_fail 2 ${MAXTEST} "Client/server (relay) w/mysql"; 350 else 351 [ -z "$quiet" ] && log_ok 2 ${MAXTEST} "Client/server (relay) w/mysql"; 352 fi 353 fi 354 # 173 355 # 174 356 if [ -f ./yule ]; then … … 177 359 netstat -pant 2>/dev/null | grep 49777 | grep yule >/dev/null 2>&1 178 360 if [ $? -ne 0 ]; then 179 [ -z "$quiet" ] && log_fail 2${MAXTEST} "Client/server w/mysql";361 [ -z "$quiet" ] && log_fail 3 ${MAXTEST} "Client/server w/mysql"; 180 362 else 181 363 NSOCK=`netstat -pand 2>/dev/null | grep STREAM | grep yule | wc -l` 182 364 if [ $NSOCK -ne 2 ]; then 183 [ -z "$quiet" ] && log_fail 2${MAXTEST} "Three sockets open";365 [ -z "$quiet" ] && log_fail 3 ${MAXTEST} "Three sockets open"; 184 366 netstat -pand 2>/dev/null | grep yule 185 367 else 186 [ -z "$quiet" ] && log_ok 2${MAXTEST} "Three sockets open";368 [ -z "$quiet" ] && log_ok 3 ${MAXTEST} "Three sockets open"; 187 369 fi 188 370 fi … … 190 372 kill $PID 191 373 else 192 log_fail 2${MAXTEST} "Three sockets open";374 log_fail 3 ${MAXTEST} "Three sockets open"; 193 375 fi 194 376 # 195 377 GPG=`find_path gpg` 196 378 if [ -z "$GPG" ]; then 197 log_skip 3$MAXTEST 'gpg not found in $PATH'379 log_skip 4 $MAXTEST 'gpg not found in $PATH' 198 380 else 199 381 eval "$GPG" --list-keys 0F571F6C >/dev/null 2>/dev/null 200 382 if [ $? -ne 0 ]; then 201 log_skip 3$MAXTEST 'public PGP key 0x0F571F6C not present'383 log_skip 4 $MAXTEST 'public PGP key 0x0F571F6C not present' 202 384 else 203 385 testrun_threesockets "$GPG" … … 208 390 netstat -pant 2>/dev/null | grep 49777 | grep yule >/dev/null 2>&1 209 391 if [ $? -ne 0 ]; then 210 [ -z "$quiet" ] && log_fail 3${MAXTEST} "Three sockets open (gpg)";392 [ -z "$quiet" ] && log_fail 4 ${MAXTEST} "Three sockets open (gpg)"; 211 393 else 212 394 NSOCK=`netstat -pand 2>/dev/null | grep STREAM | grep yule | wc -l` 213 395 if [ $NSOCK -ne 2 ]; then 214 [ -z "$quiet" ] && log_fail 3${MAXTEST} "Three sockets open (gpg)";396 [ -z "$quiet" ] && log_fail 4 ${MAXTEST} "Three sockets open (gpg)"; 215 397 netstat -pand 2>/dev/null | grep yule 216 398 else 217 [ -z "$quiet" ] && log_ok 3${MAXTEST} "Three sockets open (gpg)";399 [ -z "$quiet" ] && log_ok 4 ${MAXTEST} "Three sockets open (gpg)"; 218 400 fi 219 401 fi … … 221 403 kill $PID 222 404 else 223 log_fail 3${MAXTEST} "Three sockets open (gpg)";405 log_fail 4 ${MAXTEST} "Three sockets open (gpg)"; 224 406 fi 225 407 fi
Note:
See TracChangeset
for help on using the changeset viewer.