Changeset 59
- Timestamp:
- Aug 31, 2006, 9:25:02 PM (20 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
-
configure.ac (modified) (1 diff)
-
docs/Changelog (modified) (2 diffs)
-
docs/MANUAL-2_2.html.tar (modified) ( previous)
-
docs/MANUAL-2_2.pdf (modified) ( previous)
-
init/samhain.startFreeBSD.in (modified) (1 diff)
-
init/samhain.startLinux.in (modified) (2 diffs)
-
init/samhain.startSolaris.in (modified) (1 diff)
-
samhain-install.sh.in (modified) (6 diffs)
-
samhainrc.freebsd (modified) (1 diff)
-
samhainrc.netbsd (modified) (1 diff)
-
src/samhain.c (modified) (3 diffs)
-
src/sh_unix.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r57 r59 13 13 dnl start 14 14 dnl 15 AM_INIT_AUTOMAKE(samhain, 2.2. 3)15 AM_INIT_AUTOMAKE(samhain, 2.2.4) 16 16 AC_CANONICAL_HOST 17 17 -
trunk/docs/Changelog
r58 r59 1 1 2.2.4: 2 * fixed sh_unix.c: bug in database init if GrowingLogFiles used 3 with signed database (reported by Timothy Stotts) 4 * bug in manual fixed (incorrect documentation of --enable-user, 5 noticed by M. Brown) 6 * rc.subr compatible init script for FreeBSD/NetBSD 2 7 * improve routine to find rpm after build 3 8 * add netbsd rc file from Brian Seklecki (taken from pkgsrc-wip) … … 5 10 * fix bug with SuidExclude (files in directory were still checked) 6 11 7 2.2.3 :12 2.2.3 (31-07-2006): 8 13 * fix samhainadmin.pl: check for gpg-agent running if use-agent is set 9 14 (ticket #28 by anonymous) -
trunk/init/samhain.startFreeBSD.in
r1 r59 1 #! /bin/sh - 1 #!/bin/sh 2 3 # PROVIDE: @install_name@ 4 # REQUIRE: LOGIN 5 # KEYWORD: shutdown 6 7 . /etc/rc.subr 8 9 name="@install_name@" 10 rcvar=`set_rcvar` 11 12 pidfile="@mylockfile@" 13 14 # there are no required_files in general, 15 # as they might be downloaded from the server 2 16 # 3 # initialization/shutdown script for @install_name@ package17 # required_files="@myconffile@ @mydatafile@" 4 18 5 prefix="@prefix@"6 exec_prefix="@exec_prefix@"19 extra_commands="reload" 20 stop_postcmd="remove_stale_files" 7 21 8 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 9 DAEMON=@sbindir@/@install_name@ 10 NAME=@install_name@ 11 pidfile=@mylockfile@ 22 command="@sbindir@/@install_name@" 12 23 13 test -f $DAEMON || exit 0 14 15 safe_pidof () { 16 pidval=0 17 if [ -f $pidfile ] ; then 18 pidval=`cat $pidfile | awk '{ print $1 }'` 19 echo "${pidval}" | grep ['[^0123456789]'] >/dev/null 2>&1 && pidval=0 20 fi 21 echo $pidval 22 if [ x"$pidval" = x0 ] ; then 23 return 1 24 else 25 return 0 26 fi 24 is_set() 25 { 26 eval "[ -n \"\${$1+X}\" ]" 27 27 } 28 28 29 log_stat_msg () { 30 case "$1" in 31 0) 32 echo "Service $NAME: Running"; 33 break; 34 ;; 35 1) 36 echo "Service $NAME: Stopped and @mylockfile@ pid file exists"; 37 break; 38 ;; 39 3) 40 echo "Service $NAME: Stopped"; 41 break; 42 ;; 43 *) 44 echo "Service $NAME: Status unknown"; 45 break; 46 ;; 47 esac 29 remove_stale_files() 30 { 31 if test -f @mylockfile@; then 32 /bin/rm -f @mylockfile@ 33 fi 34 /bin/rm -f @mylockdir@/${name}.sock 48 35 } 49 36 50 case "$1" in 51 start) 52 # 53 # Remove a stale lockfile, if found 54 # 55 if test -f @mylockfile@; then 56 rm -f @mylockfile@ 57 fi 58 /bin/rm -f @mylockdir@/${NAME}.sock 59 $DAEMON -D && echo -n " $NAME" 60 ;; 61 stop) 62 PID=`safe_pidof` 63 if test "x$PID" != x0 64 then 65 kill $PID && echo -n " $NAME" 66 fi 67 ;; 68 reload|force-reload) 69 PID=`safe_pidof` 70 if test "x$PID" != x0 71 then 72 echo " Reloading $NAME configuration file." 73 kill -s HUP $PID && echo -n " $NAME" 74 else 75 echo " Cannot determine PID of process $NAME." 76 exit 1 77 fi 78 ;; 79 restart) 80 $0 stop 81 sleep 3 82 $0 start 83 ;; 84 status) 85 $DAEMON status 86 ERRNUM=$? 87 log_stat_msg ${ERRNUM} 88 exit ${ERRNUM} 89 ;; 90 *) 91 echo " Usage: $0 {start|stop|restart|reload|force-reload}" >&2 92 exit 1 93 ;; 94 esac 37 load_rc_config "$name" 95 38 39 if ! is_set ${rcvar}; then 40 eval "${rcvar}=YES" 41 fi 42 43 run_rc_command "$1" 44 -
trunk/init/samhain.startLinux.in
r1 r59 63 63 fi 64 64 65 function debian_end()65 debian_end() 66 66 { 67 67 if [ $RETVAL -eq 0 ]; … … 103 103 104 104 # echo OK in green if is success, FAILED in red is failed 105 function generic_end()105 generic_end() 106 106 { 107 107 if [ $RETVAL -eq 0 ]; -
trunk/init/samhain.startSolaris.in
r1 r59 9 9 10 10 11 log_stat_msg () {11 log_stat_msg() { 12 12 case "$1" in 13 13 0) -
trunk/samhain-install.sh.in
r1 r59 672 672 realname="$user" 673 673 case "$platform" in 674 FreeBSD/* | NetBSD/* )674 FreeBSD/* | NetBSD/* | OpenBSD/* ) 675 675 file=/etc/master.passwd 676 676 entry="${user}:*:${uid}:${gid}::0:0:${realname}:${home}:${shell}" … … 785 785 ;; 786 786 787 OpenBSD/*) 788 test -z "$verbose" || echo " OpenBSD system detected" 789 grep '^## begin @install_name@' /etc/rc.local >/dev/null 2>&1 790 if [ $? -eq 0 ]; then 791 RCLOCALTMP=`mktemp /etc/rc.local.XXXXXXXXXX` || exit 1 792 sed "/^## begin @install_name@/,/^## end @install_name@/d" /etc/rc.local >$RCLOCALTMP || exit 1 793 cat $RCLOCALTMP >/etc/rc.local || exit 1 794 rm -f $RCLOCALTMP || exit 1 795 if test x"$act" = xuboot; then 796 echo " uninstalling from /etc/rc.local completed" 797 fi 798 fi 799 if test x"$act" = xboot; then 800 echo "## begin @install_name@" >>/etc/rc.local || exit 1 801 echo "if [ -x @sbindir@/@install_name@ ]; then" >>/etc/rc.local || exit 1 802 echo " @sbindir@/@install_name@ start" >>/etc/rc.local || exit 1 803 echo "fi" >>/etc/rc.local || exit 1 804 echo "## end @install_name@" >>/etc/rc.local || exit 1 805 echo " installing to /etc/rc.local completed" 806 fi 807 exit 0 808 ;; 809 810 NetBSD/*) 811 test -z "$verbose" || echo " NetBSD system detected" 812 if test -f /etc/rc.subr; then 813 DVER="FreeBSD" 814 rc_main=${DESTDIR}/etc/rc.d 815 rc_dirz= 816 rc_inst="chmod 755 /etc/rc.d/@install_name@" 817 rc_uinst="rm -f /etc/rc.d/@install_name@" 818 else 819 echo "${0}: unsupported platform ${platform} (too old)" 820 exit 1 821 fi 822 ;; 823 787 824 FreeBSD/* ) 788 DVER="FreeBSD"789 825 test -z "$verbose" || echo " FreeBSD system detected" 790 rc_main=${DESTDIR}/usr/local/etc/rc.d 791 rc_dirz= 792 rc_inst="mv /usr/local/etc/rc.d/@install_name@ /usr/local/etc/rc.d/@install_name@.sh && chmod 755 /usr/local/etc/rc.d/@install_name@.sh" 793 rc_uinst="rm -f /usr/local/etc/rc.d/@install_name@.sh; echo You may want to remove ${rc_main} from local_startup in /etc/rc.conf; echo if it is empty" 826 if test -f /etc/rc.subr; then 827 DVER="FreeBSD" 828 rc_main=${DESTDIR}/etc/rc.d 829 rc_dirz= 830 rc_inst="chmod 755 /etc/rc.d/@install_name@" 831 rc_uinst="rm -f /etc/rc.d/@install_name@" 832 else 833 DVER="Solaris" 834 rc_main=${DESTDIR}/usr/local/etc/rc.d 835 rc_dirz= 836 rc_inst="mv /usr/local/etc/rc.d/@install_name@ /usr/local/etc/rc.d/@install_name@.sh && chmod 755 /usr/local/etc/rc.d/@install_name@.sh" 837 rc_uinst="rm -f /usr/local/etc/rc.d/@install_name@.sh" 838 fi 794 839 if test x"$act" = xboot 795 840 then … … 797 842 test x"$act" = xboot && mkdir ${rc_main} 798 843 fi 844 if test "x$DVER" = "xSolaris"; then 799 845 ( . /etc/defaults/rc.conf 800 846 . /etc/rc.conf … … 814 860 fi 815 861 ) 816 fi 862 fi 863 fi 817 864 ;; 865 818 866 SunOS/5.* ) 819 867 DVER="Solaris" 868 DVER_REAL="Solaris" 820 869 test -z "$verbose" || echo " Solaris system detected" 821 870 rc_dirz= … … 824 873 rc_uinst="rm -f ${DESTDIR}/etc/init.d/@install_name@; rm -f ${DESTDIR}/etc/rc0.d/K10@install_name@; rm -f ${DESTDIR}/etc/rc1.d/K10@install_name@; rm -f ${DESTDIR}/etc/rc3.d/S99@install_name@" 825 874 ;; 875 826 876 Linux/*) 827 877 rlv="2 3 4 5" … … 1005 1055 ${mkinstalldirs} ${rc_main} 1006 1056 # 1007 if test x"$ DVER" = xSolaris; then1057 if test x"${DVER_REAL}" = xSolaris; then 1008 1058 ${mkinstalldirs} ${DESTDIR}/etc/rc0.d 1009 1059 ${mkinstalldirs} ${DESTDIR}/etc/rc1.d -
trunk/samhainrc.freebsd
r14 r59 177 177 # 178 178 179 [ReadOnly]180 file = /var181 182 179 [Attributes] 183 180 -
trunk/samhainrc.netbsd
r56 r59 774 774 775 775 776 ## The digest/checksum/hash algorithm 777 # 778 DigestAlgo = MD5 776 ## The digest/checksum/hash algorithm (default: TIGER192; others: MD5, SHA1) 777 # 778 # DigestAlgo = TIGER192 779 779 780 780 -
trunk/src/samhain.c
r52 r59 652 652 sh_files_delfilestack (); 653 653 sh_hash_hashdelete(); 654 sh_files_hle_reg (NULL); 654 655 #endif 655 656 #if defined(SH_WITH_SERVER) … … 1369 1370 } 1370 1371 1371 /* initialize signal handling etc1372 */1373 1372 if (sh.flag.isdaemon == S_TRUE) 1374 1373 sh_error_only_stderr (BAD); 1375 1374 1375 /* --- load database; checksum of database 1376 */ 1377 #if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE) 1378 TPT((0, FIL__, __LINE__, _("msg=<Get checksum of the database.>\n"))) 1379 if (sh.flag.checkSum == SH_CHECK_CHECK) 1380 { 1381 if (0 != sl_strcmp(file_path('D', 'R'), _("REQ_FROM_SERVER"))) 1382 { 1383 (void) sl_strlcpy(sh.data.hash, 1384 sh_tiger_hash (file_path('D', 'R'), 1385 TIGER_FILE, 0), 1386 KEY_LEN+1); 1387 } 1388 1389 /* this eventually fetches the file from server to get checksum 1390 */ 1391 sh_hash_init (); 1392 } 1393 #endif 1394 1395 /* --- initialize signal handling etc.; fork daemon 1396 */ 1376 1397 if (sh_unix_init(sh.flag.isdaemon) == -1) 1377 1398 { … … 1409 1430 #if defined(INET_SYSLOG) && defined(SH_WITH_SERVER) 1410 1431 create_syslog_socket (S_FALSE); 1411 #endif1412 1413 1414 /* checksum of database1415 */1416 #if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)1417 TPT((0, FIL__, __LINE__, _("msg=<Get checksum of the database.>\n")))1418 if (sh.flag.checkSum == SH_CHECK_CHECK)1419 {1420 if (0 == sl_strcmp(file_path('D', 'R'), _("REQ_FROM_SERVER")))1421 {1422 /* fetch the file from server to get checksum1423 */1424 sh_hash_init ();1425 /* sh_hash_hashdelete (); */1426 }1427 else1428 {1429 (void) sl_strlcpy(sh.data.hash,1430 sh_tiger_hash (file_path('D', 'R'),1431 TIGER_FILE, 0),1432 KEY_LEN+1);1433 }1434 }1435 1432 #endif 1436 1433 -
trunk/src/sh_unix.c
r52 r59 2843 2843 SL_ENTER(_("sh_unix_checksum_size")); 2844 2844 2845 /* lookup file in database */ 2846 status = sh_hash_get_it (filename, &tmpFile); 2847 if (status != 0) { 2848 goto out; 2849 } 2845 if (sh.flag.checkSum != SH_CHECK_INIT) 2846 { 2847 /* lookup file in database */ 2848 status = sh_hash_get_it (filename, &tmpFile); 2849 if (status != 0) { 2850 goto out; 2851 } 2852 } 2853 else 2854 { 2855 tmpFile.size = fbuf->st_size; 2856 } 2850 2857 2851 2858 /* if last < current get checksum */ … … 2853 2860 { 2854 2861 sl_strlcpy(fileHash, 2855 sh_tiger_generic_hash (filename, TIGER_FD, tmpFile.size,2856 alert_timeout),2857 KEY_LEN+1);2862 sh_tiger_generic_hash (filename, TIGER_FD, tmpFile.size, 2863 alert_timeout), 2864 KEY_LEN+1); 2858 2865 2859 2866 /* return */
Note:
See TracChangeset
for help on using the changeset viewer.