Changeset 367
- Timestamp:
- Oct 30, 2011, 9:18:31 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile.in
r364 r367 126 126 sh_log_check.h sh_log_evalrule.h sh_log_correlate.h \ 127 127 sh_log_mark.h sh_log_repeat.h sh_inotify.h sh_registry.h sh_ipvx.h \ 128 sh_restrict.h sh_sub.h 128 sh_restrict.h sh_sub.h sh_fInotify.h 129 129 130 130 … … 169 169 $(srcsrc)/sh_audit.c $(srcsrc)/sh_registry.c \ 170 170 $(srcsrc)/sh_ipvx.c $(srcsrc)/sh_restrict.c \ 171 $(srcsrc)/sh_filetype.c $(srcsrc)/sh_sub.c \172 $(srcsrc)/t-test1.c 171 $(srcsrc)/sh_filetype.c $(srcsrc)/sh_sub.c $(srcsrc)/sh_fInotify.c\ 172 $(srcsrc)/t-test1.c 173 173 174 174 OBJECTS = sh_files.o sh_tiger0.o sh_tiger2.o sh_tiger2_64.o \ … … 190 190 sh_pthread.o sh_string.o sh_inotify.o dnmalloc.o \ 191 191 sh_audit.o sh_registry.o sh_ipvx.o sh_restrict.o \ 192 sh_filetype.o sh_sub.o 192 sh_filetype.o sh_sub.o sh_fInotify.o 193 193 194 194 KERN = kern_head.h kern_head.c … … 1705 1705 1706 1706 1707 samhain.o: $(srcsrc)/samhain.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_ files.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_getopt.h $(srcinc)/sh_readconf.h $(srcinc)/sh_hash.h $(srcinc)/sh_restrict.h $(srcinc)/sh_nmail.h $(srcinc)/sh_tiger.h $(srcinc)/sh_gpg.h $(srcinc)/sh_mem.h $(srcinc)/sh_forward.h $(srcinc)/sh_tools.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h $(srcinc)/sh_modules.h $(srcinc)/sh_ignore.h $(srcinc)/sh_prelink.h sh_MK.h $(srcinc)/sh_schedule.h1707 samhain.o: $(srcsrc)/samhain.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_getopt.h $(srcinc)/sh_readconf.h $(srcinc)/sh_hash.h $(srcinc)/sh_restrict.h $(srcinc)/sh_nmail.h $(srcinc)/sh_tiger.h $(srcinc)/sh_gpg.h $(srcinc)/sh_mem.h $(srcinc)/sh_forward.h $(srcinc)/sh_tools.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h $(srcinc)/sh_modules.h $(srcinc)/sh_ignore.h $(srcinc)/sh_prelink.h sh_MK.h $(srcinc)/sh_schedule.h 1708 1708 sh_unix.o: $(srcsrc)/sh_unix.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_hash.h $(srcinc)/sh_tools.h $(srcinc)/sh_restrict.h $(srcinc)/sh_ipvx.h $(srcinc)/sh_tiger.h $(srcinc)/sh_prelink.h $(srcinc)/sh_pthread.h $(srcinc)/sh_static.h $(srcinc)/sh_prelude.h $(srcinc)/zAVLTree.h $(srcinc)/sh_ignore.h 1709 1709 sh_utils.o: $(srcsrc)/sh_utils.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_entropy.h $(srcinc)/sh_pthread.h 1710 1710 sh_error.o: $(srcsrc)/sh_error.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_cat.h $(srcinc)/sh_database.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_nmail.h $(srcinc)/sh_forward.h $(srcinc)/sh_prelude.h $(srcinc)/sh_pthread.h $(srcinc)/sh_tools.h $(srcinc)/sh_extern.h 1711 sh_files.o: $(srcsrc)/sh_files.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_tiger.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/ zAVLTree.h $(srcinc)/CuTest.h1712 sh_getopt.o: $(srcsrc)/sh_getopt.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_getopt.h $(srcinc)/sh_ files.h $(srcinc)/sh_utils.h $(srcinc)/sh_mail.h $(srcinc)/sh_forward.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h1713 sh_readconf.o: $(srcsrc)/sh_readconf.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_calls.h $(srcinc)/sh_error.h $(srcinc)/sh_extern.h $(srcinc)/sh_ files.h $(srcinc)/sh_forward.h $(srcinc)/sh_gpg.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_database.h $(srcinc)/sh_mail.h $(srcinc)/sh_modules.h $(srcinc)/sh_nmail.h $(srcinc)/sh_prelink.h $(srcinc)/sh_prelude.h $(srcinc)/sh_tiger.h $(srcinc)/sh_tools.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_restrict.h1711 sh_files.o: $(srcsrc)/sh_files.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_tiger.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_inotify.h $(srcinc)/zAVLTree.h $(srcinc)/CuTest.h 1712 sh_getopt.o: $(srcsrc)/sh_getopt.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_getopt.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_utils.h $(srcinc)/sh_mail.h $(srcinc)/sh_forward.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h 1713 sh_readconf.o: $(srcsrc)/sh_readconf.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_calls.h $(srcinc)/sh_error.h $(srcinc)/sh_extern.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_forward.h $(srcinc)/sh_gpg.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_database.h $(srcinc)/sh_mail.h $(srcinc)/sh_modules.h $(srcinc)/sh_nmail.h $(srcinc)/sh_prelink.h $(srcinc)/sh_prelude.h $(srcinc)/sh_tiger.h $(srcinc)/sh_tools.h $(srcinc)/sh_utils.h $(srcinc)/sh_restrict.h 1714 1714 sh_tiger0.o: $(srcsrc)/sh_tiger0.c Makefile config_xor.h $(srcinc)/sh_tiger.h $(srcinc)/sh_unix.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_pthread.h $(srcinc)/sh_string.h 1715 1715 sh_tiger1.o: $(srcsrc)/sh_tiger1.c Makefile config_xor.h … … 1722 1722 sh_entropy.o: $(srcsrc)/sh_entropy.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_calls.h $(srcinc)/sh_pthread.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h $(srcinc)/CuTest.h 1723 1723 sh_forward.o: $(srcsrc)/sh_forward.c Makefile config_xor.h $(srcinc)/sh_ipvx.h $(srcinc)/samhain.h $(srcinc)/sh_tiger.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_forward.h $(srcinc)/sh_srp.h $(srcinc)/sh_fifo.h $(srcinc)/sh_tools.h $(srcinc)/sh_entropy.h $(srcinc)/sh_html.h $(srcinc)/sh_nmail.h $(srcinc)/sh_socket.h $(srcinc)/sh_static.h $(srcinc)/rijndael-api-fst.h $(srcinc)/sh_readconf.h $(srcinc)/zAVLTree.h $(srcinc)/sh_extern.h 1724 sh_modules.o: $(srcsrc)/sh_modules.c Makefile config_xor.h $(srcinc)/sh_modules.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utmp.h $(srcinc)/sh_mounts.h $(srcinc)/sh_userfiles.h $(srcinc)/sh_kern.h $(srcinc)/sh_suidchk.h $(srcinc)/sh_processcheck.h $(srcinc)/sh_portcheck.h $(srcinc)/sh_logmon.h $(srcinc)/sh_registry.h 1724 sh_modules.o: $(srcsrc)/sh_modules.c Makefile config_xor.h $(srcinc)/sh_modules.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utmp.h $(srcinc)/sh_mounts.h $(srcinc)/sh_userfiles.h $(srcinc)/sh_kern.h $(srcinc)/sh_suidchk.h $(srcinc)/sh_processcheck.h $(srcinc)/sh_portcheck.h $(srcinc)/sh_logmon.h $(srcinc)/sh_registry.h $(srcinc)/sh_fInotify.h 1725 1725 sh_utmp.o: $(srcsrc)/sh_utmp.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_modules.h $(srcinc)/sh_utmp.h $(srcinc)/sh_pthread.h $(srcinc)/sh_inotify.h 1726 1726 sh_kern.o: $(srcsrc)/sh_kern.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_modules.h $(srcinc)/sh_kern.h sh_ks_xor.h $(srcinc)/sh_unix.h $(srcinc)/sh_hash.h … … 1779 1779 sh_nmail.o: $(srcsrc)/sh_nmail.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_mem.h $(srcinc)/sh_mail.h $(srcinc)/sh_tiger.h $(srcinc)/sh_string.h $(srcinc)/sh_utils.h $(srcinc)/sh_fifo.h $(srcinc)/sh_filter.h $(srcinc)/sh_mail_int.h $(srcinc)/zAVLTree.h 1780 1780 sh_filter.o: $(srcsrc)/sh_filter.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_filter.h 1781 sh_inotify.o: $(srcsrc)/sh_inotify.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_calls.h $(srcinc)/sh_inotify.h $(srcinc)/sh_mem.h $(srcinc)/sh_utils.h $(srcinc)/slib.h $(srcinc)/zAVLTree.h $(srcinc)/sh_calls.h $(srcinc)/sh_inotify.h 1781 sh_inotify.o: $(srcsrc)/sh_inotify.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_calls.h $(srcinc)/sh_inotify.h $(srcinc)/sh_mem.h $(srcinc)/sh_utils.h $(srcinc)/slib.h $(srcinc)/zAVLTree.h $(srcinc)/sh_calls.h $(srcinc)/sh_inotify.h $(srcinc)/CuTest.h 1782 1782 sh_log_correlate.o: $(srcsrc)/sh_log_correlate.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h 1783 1783 sh_log_mark.o: $(srcsrc)/sh_log_mark.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_mem.h $(srcinc)/sh_string.h $(srcinc)/sh_error_min.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h $(srcinc)/zAVLTree.h … … 1791 1791 sh_filetype.o: $(srcsrc)/sh_filetype.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error_min.h $(srcinc)/sh_utils.h 1792 1792 sh_sub.o: $(srcsrc)/sh_sub.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h 1793 sh_fInotify.o: $(srcsrc)/sh_fInotify.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_modules.h $(srcinc)/sh_pthread.h $(srcinc)/sh_inotify.h $(srcinc)/sh_unix.h $(srcinc)/sh_hash.h $(srcinc)/sh_files.h $(srcinc)/sh_ignore.h -
trunk/configure.ac
r359 r367 12 12 dnl start 13 13 dnl 14 AM_INIT_AUTOMAKE(samhain, 2.8. 6)14 AM_INIT_AUTOMAKE(samhain, 2.8.99) 15 15 AC_DEFINE([SAMHAIN], 1, [Application is samhain]) 16 16 AC_CANONICAL_HOST -
trunk/depend.dep
r364 r367 1 1 2 2 # DO NOT DELETE THIS LINE 3 samhain.o: $(srcsrc)/samhain.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_ files.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_getopt.h $(srcinc)/sh_readconf.h $(srcinc)/sh_hash.h $(srcinc)/sh_restrict.h $(srcinc)/sh_nmail.h $(srcinc)/sh_tiger.h $(srcinc)/sh_gpg.h $(srcinc)/sh_mem.h $(srcinc)/sh_forward.h $(srcinc)/sh_tools.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h $(srcinc)/sh_modules.h $(srcinc)/sh_ignore.h $(srcinc)/sh_prelink.h sh_MK.h $(srcinc)/sh_schedule.h3 samhain.o: $(srcsrc)/samhain.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_getopt.h $(srcinc)/sh_readconf.h $(srcinc)/sh_hash.h $(srcinc)/sh_restrict.h $(srcinc)/sh_nmail.h $(srcinc)/sh_tiger.h $(srcinc)/sh_gpg.h $(srcinc)/sh_mem.h $(srcinc)/sh_forward.h $(srcinc)/sh_tools.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h $(srcinc)/sh_modules.h $(srcinc)/sh_ignore.h $(srcinc)/sh_prelink.h sh_MK.h $(srcinc)/sh_schedule.h 4 4 sh_unix.o: $(srcsrc)/sh_unix.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_hash.h $(srcinc)/sh_tools.h $(srcinc)/sh_restrict.h $(srcinc)/sh_ipvx.h $(srcinc)/sh_tiger.h $(srcinc)/sh_prelink.h $(srcinc)/sh_pthread.h $(srcinc)/sh_static.h $(srcinc)/sh_prelude.h $(srcinc)/zAVLTree.h $(srcinc)/sh_ignore.h 5 5 sh_utils.o: $(srcsrc)/sh_utils.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_entropy.h $(srcinc)/sh_pthread.h 6 6 sh_error.o: $(srcsrc)/sh_error.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_cat.h $(srcinc)/sh_database.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_nmail.h $(srcinc)/sh_forward.h $(srcinc)/sh_prelude.h $(srcinc)/sh_pthread.h $(srcinc)/sh_tools.h $(srcinc)/sh_extern.h 7 sh_files.o: $(srcsrc)/sh_files.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_tiger.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/ zAVLTree.h $(srcinc)/CuTest.h8 sh_getopt.o: $(srcsrc)/sh_getopt.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_getopt.h $(srcinc)/sh_ files.h $(srcinc)/sh_utils.h $(srcinc)/sh_mail.h $(srcinc)/sh_forward.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h9 sh_readconf.o: $(srcsrc)/sh_readconf.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_calls.h $(srcinc)/sh_error.h $(srcinc)/sh_extern.h $(srcinc)/sh_ files.h $(srcinc)/sh_forward.h $(srcinc)/sh_gpg.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_database.h $(srcinc)/sh_mail.h $(srcinc)/sh_modules.h $(srcinc)/sh_nmail.h $(srcinc)/sh_prelink.h $(srcinc)/sh_prelude.h $(srcinc)/sh_tiger.h $(srcinc)/sh_tools.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_restrict.h7 sh_files.o: $(srcsrc)/sh_files.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_tiger.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_inotify.h $(srcinc)/zAVLTree.h $(srcinc)/CuTest.h 8 sh_getopt.o: $(srcsrc)/sh_getopt.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_getopt.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_utils.h $(srcinc)/sh_mail.h $(srcinc)/sh_forward.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h 9 sh_readconf.o: $(srcsrc)/sh_readconf.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_calls.h $(srcinc)/sh_error.h $(srcinc)/sh_extern.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_forward.h $(srcinc)/sh_gpg.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_database.h $(srcinc)/sh_mail.h $(srcinc)/sh_modules.h $(srcinc)/sh_nmail.h $(srcinc)/sh_prelink.h $(srcinc)/sh_prelude.h $(srcinc)/sh_tiger.h $(srcinc)/sh_tools.h $(srcinc)/sh_utils.h $(srcinc)/sh_restrict.h 10 10 sh_tiger0.o: $(srcsrc)/sh_tiger0.c Makefile config_xor.h $(srcinc)/sh_tiger.h $(srcinc)/sh_unix.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_pthread.h $(srcinc)/sh_string.h 11 11 sh_tiger1.o: $(srcsrc)/sh_tiger1.c Makefile config_xor.h … … 18 18 sh_entropy.o: $(srcsrc)/sh_entropy.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_calls.h $(srcinc)/sh_pthread.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h $(srcinc)/CuTest.h 19 19 sh_forward.o: $(srcsrc)/sh_forward.c Makefile config_xor.h $(srcinc)/sh_ipvx.h $(srcinc)/samhain.h $(srcinc)/sh_tiger.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_forward.h $(srcinc)/sh_srp.h $(srcinc)/sh_fifo.h $(srcinc)/sh_tools.h $(srcinc)/sh_entropy.h $(srcinc)/sh_html.h $(srcinc)/sh_nmail.h $(srcinc)/sh_socket.h $(srcinc)/sh_static.h $(srcinc)/rijndael-api-fst.h $(srcinc)/sh_readconf.h $(srcinc)/zAVLTree.h $(srcinc)/sh_extern.h 20 sh_modules.o: $(srcsrc)/sh_modules.c Makefile config_xor.h $(srcinc)/sh_modules.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utmp.h $(srcinc)/sh_mounts.h $(srcinc)/sh_userfiles.h $(srcinc)/sh_kern.h $(srcinc)/sh_suidchk.h $(srcinc)/sh_processcheck.h $(srcinc)/sh_portcheck.h $(srcinc)/sh_logmon.h $(srcinc)/sh_registry.h 20 sh_modules.o: $(srcsrc)/sh_modules.c Makefile config_xor.h $(srcinc)/sh_modules.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utmp.h $(srcinc)/sh_mounts.h $(srcinc)/sh_userfiles.h $(srcinc)/sh_kern.h $(srcinc)/sh_suidchk.h $(srcinc)/sh_processcheck.h $(srcinc)/sh_portcheck.h $(srcinc)/sh_logmon.h $(srcinc)/sh_registry.h $(srcinc)/sh_fInotify.h 21 21 sh_utmp.o: $(srcsrc)/sh_utmp.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_modules.h $(srcinc)/sh_utmp.h $(srcinc)/sh_pthread.h $(srcinc)/sh_inotify.h 22 22 sh_kern.o: $(srcsrc)/sh_kern.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_modules.h $(srcinc)/sh_kern.h sh_ks_xor.h $(srcinc)/sh_unix.h $(srcinc)/sh_hash.h … … 77 77 sh_nmail.o: $(srcsrc)/sh_nmail.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_mem.h $(srcinc)/sh_mail.h $(srcinc)/sh_tiger.h $(srcinc)/sh_string.h $(srcinc)/sh_utils.h $(srcinc)/sh_fifo.h $(srcinc)/sh_filter.h $(srcinc)/sh_mail_int.h $(srcinc)/zAVLTree.h 78 78 sh_filter.o: $(srcsrc)/sh_filter.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_filter.h 79 sh_inotify.o: $(srcsrc)/sh_inotify.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_calls.h $(srcinc)/sh_inotify.h $(srcinc)/sh_mem.h $(srcinc)/sh_utils.h $(srcinc)/slib.h $(srcinc)/zAVLTree.h $(srcinc)/sh_calls.h $(srcinc)/sh_inotify.h 79 sh_inotify.o: $(srcsrc)/sh_inotify.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_calls.h $(srcinc)/sh_inotify.h $(srcinc)/sh_mem.h $(srcinc)/sh_utils.h $(srcinc)/slib.h $(srcinc)/zAVLTree.h $(srcinc)/sh_calls.h $(srcinc)/sh_inotify.h $(srcinc)/CuTest.h 80 80 sh_log_correlate.o: $(srcsrc)/sh_log_correlate.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h 81 81 sh_log_mark.o: $(srcsrc)/sh_log_mark.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_mem.h $(srcinc)/sh_string.h $(srcinc)/sh_error_min.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h $(srcinc)/zAVLTree.h … … 89 89 sh_filetype.o: $(srcsrc)/sh_filetype.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error_min.h $(srcinc)/sh_utils.h 90 90 sh_sub.o: $(srcsrc)/sh_sub.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h 91 sh_fInotify.o: $(srcsrc)/sh_fInotify.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_modules.h $(srcinc)/sh_pthread.h $(srcinc)/sh_inotify.h $(srcinc)/sh_unix.h $(srcinc)/sh_hash.h $(srcinc)/sh_files.h $(srcinc)/sh_ignore.h -
trunk/depend.sum
r364 r367 1 2156182040 1 3842322487 -
trunk/docs/Changelog
r359 r367 1 2.8.6: 1 3.0.0: 2 * Fix missing check_mask storage for glob pattern 3 * Add support for integer keys in zAVL 4 * Fix compiler warnings with gcc 4.6.1 (variables that get set 5 but then remain unused) 6 * Add more server-side debugging for IPv6 7 * Make kern_head compile with 3.x kernels 8 9 2.8.6 (20-09-2011): 2 10 * Manual updated. 3 11 * Added an option LogmonDeadtime to avoid repetitive reporting -
trunk/include/samhain.h
r295 r367 200 200 #define CLEAR_SH_FFLAG_SUIDCHK(a) ((a) &= ~SH_FFLAG_SUIDCHK) 201 201 202 /* Flags for inotify 203 */ 204 #define SH_INOTIFY_USE (1<<0) 205 #define SH_INOTIFY_DOSCAN (1<<1) 206 #define SH_INOTIFY_NEEDINIT (1<<2) 207 202 208 203 209 /************************************************** … … 282 288 int audit; 283 289 unsigned long aud_mask; 284 int hidefile; /* TRUE if file not reveled in log */ 290 int hidefile; /* TRUE if file not shown in log */ 291 int inotify; /* Flags for inotify */ 285 292 } sh_sh_flag; 286 293 -
trunk/include/sh_files.h
r294 r367 221 221 int sh_files_redef_allignore(const char * str); 222 222 223 ShFileType sh_files_filecheck (int class, unsigned long check_mask, 224 char * dirName, 225 char * infileName, 226 int * reported, 227 int rsrcflag); 228 229 int sh_files_search_file(char * name, int * class, unsigned long *check_mask, int * reported); 230 void sh_files_set_file_reported(char * name); 231 void sh_files_clear_file_reported(char * name); 223 232 224 233 #endif -
trunk/include/sh_inotify.h
r364 r367 19 19 } sh_watches; 20 20 21 #define SH_INOTIFY_INITIALIZER { { 0 }, { 0 }, { NULL}, 0, 0 } 21 /* #define SH_INOTIFY_INITIALIZER { { 0 }, { 0 }, { NULL}, 0, 0 } */ 22 23 #define SH_INOTIFY_INITIALIZER { NULL, NULL, 0, 0 } 22 24 23 25 int sh_inotify_wait_for_change(char * filename, sh_watches * watches, 24 26 int * errnum, int waitsec); 25 27 26 int sh_inotify_ add_watch(char * filename, sh_watches * watches, int * errnum);28 int sh_inotify_rm_watch (sh_watches * watches, sh_watches * save, int wd); 27 29 30 int sh_inotify_add_watch(char * filename, sh_watches * watches, int * errnum, 31 int class, unsigned long check_mask); 32 33 int sh_inotify_add_watch_later(char * filename, sh_watches * watches, int * errnum, 34 int class, unsigned long check_mask); 35 36 char * sh_inotify_pop_dormant(sh_watches * watches, int * class, unsigned long * check_mask); 37 38 void sh_inotify_purge_dormant(sh_watches * watches); 28 39 void sh_inotify_remove(sh_watches * watches); 40 void sh_inotify_init(sh_watches * watches); 41 42 char * sh_inotify_search_item(sh_watches * watches, int watch, 43 int * class, unsigned long * check_mask); 44 ssize_t sh_inotify_read(char * buffer, size_t count); 45 int sh_inotify_recheck_watches (sh_watches * watches, sh_watches * save); 29 46 30 47 #define SH_INOTIFY_ERROR(a) (a != 0) -
trunk/src/samhain.c
r354 r367 64 64 #include "samhain.h" 65 65 #include "sh_pthread.h" 66 #include "sh_files.h"67 66 #include "sh_utils.h" 68 67 #include "sh_error.h" 69 68 #include "sh_unix.h" 69 #include "sh_files.h" 70 70 #include "sh_getopt.h" 71 71 #include "sh_readconf.h" … … 393 393 sh.flag.hidefile = S_FALSE; 394 394 sh.flag.loop = S_FALSE; 395 sh.flag.inotify = 0; 395 396 396 397 #ifdef MKB_09 … … 1710 1711 (void) sh_files_test_setup(); 1711 1712 1712 1713 1713 /* -------- NICE LEVEL --------- 1714 1714 */ … … 1843 1843 (void) sh_files_setrec(); 1844 1844 (void) sh_files_test_setup(); 1845 1845 1846 if (0 != sh.flag.nice) 1846 1847 { … … 1965 1966 */ 1966 1967 if (sh.flag.checkSum == SH_CHECK_INIT || 1968 (sh.flag.inotify & SH_INOTIFY_DOSCAN) != 0 || 1967 1969 (sh.flag.checkSum == SH_CHECK_CHECK && 1968 1970 (sh.flag.isdaemon == S_FALSE && sh.flag.loop == S_FALSE))) … … 2060 2062 flag_check_2 = 0; 2061 2063 check_done = 1; 2064 sh.flag.inotify &= ~SH_INOTIFY_DOSCAN; 2062 2065 2063 2066 (void) sh_prelink_run (NULL, NULL, 0); -
trunk/src/sh_files.c
r365 r367 69 69 #include "sh_hash.h" 70 70 #include "sh_ignore.h" 71 #include "sh_inotify.h" 71 72 #include "zAVLTree.h" 72 73 73 74 #undef FIL__ 74 75 #define FIL__ _("sh_files.c") 76 77 extern sh_watches sh_file_watches; 75 78 76 79 static char * sh_files_C_dequote (char * s, size_t * length) … … 356 359 sh_error_handle ((-1), FIL__, __LINE__, 0, 357 360 MSG_FI_CHK, pstr, tmp); 361 } 362 363 if ((sh.flag.inotify & SH_INOTIFY_DOSCAN) != 0) 364 { 365 sh_inotify_add_watch_later(ptr->name, &sh_file_watches, NULL, 366 ptr->class, ptr->check_mask); 358 367 } 359 368 … … 1843 1852 } 1844 1853 1854 if ((sh.flag.inotify & SH_INOTIFY_DOSCAN) != 0) 1855 { 1856 sh_inotify_add_watch_later(iname, &sh_file_watches, &status, 1857 iclass, check_mask); 1858 } 1859 1845 1860 /* ---- stat the directory ---- 1846 1861 */ … … 2500 2515 2501 2516 /* ----------------------------------- 2517 * Routines required for inotify 2518 * ----------------------------------- 2519 */ 2520 int sh_files_search_file(char * name, int * class, unsigned long *check_mask, int *reported) 2521 { 2522 dirstack_t * item = zAVLSearch(zfileList, name); 2523 2524 if (item) 2525 { 2526 *check_mask = item->check_mask; 2527 *class = item->class; 2528 *reported = item->is_reported; 2529 return 1; 2530 } 2531 return 0; 2532 } 2533 2534 void sh_files_set_file_reported(char * name) 2535 { 2536 dirstack_t * item = zAVLSearch(zfileList, name); 2537 2538 if (item) 2539 { 2540 if (sh.flag.reportonce == S_TRUE) 2541 SET_SH_FFLAG_REPORTED(item->is_reported); 2542 } 2543 return; 2544 } 2545 2546 void sh_files_clear_file_reported(char * name) 2547 { 2548 dirstack_t * item = zAVLSearch(zfileList, name); 2549 2550 if (item) 2551 { 2552 CLEAR_SH_FFLAG_REPORTED(item->is_reported); 2553 } 2554 return; 2555 } 2556 2557 /* ----------------------------------- 2502 2558 * 2503 2559 * The following two routines serve to -
trunk/src/sh_getopt.c
r355 r367 30 30 #include "sh_error.h" 31 31 #include "sh_getopt.h" 32 #include "sh_unix.h" 32 33 #include "sh_files.h" 33 34 #include "sh_utils.h" -
trunk/src/sh_hash.c
r362 r367 434 434 char * str; 435 435 char hashbuf[KEYBUF_SIZE]; 436 int retval;436 volatile int retval; 437 437 438 438 /* -------- find the entry for the file ---------------- */ … … 459 459 str = all_items(theFile, fileHash, 0); 460 460 tmp = sh_util_safe_name(fullpath); 461 462 SH_MUTEX_LOCK(mutex_thread_nolog); 461 463 sh_error_handle (level, FIL__, __LINE__, 0, 462 464 MSG_FI_MISS2, tmp, str); 465 SH_MUTEX_UNLOCK(mutex_thread_nolog); 463 466 464 467 SH_FREE(tmp); -
trunk/src/sh_inotify.c
r364 r367 51 51 52 52 #if defined(HAVE_PTHREAD) 53 54 SH_MUTEX_STATIC(mutex_list_dormant, PTHREAD_MUTEX_INITIALIZER); 55 SH_MUTEX_STATIC(mutex_watches, PTHREAD_MUTEX_INITIALIZER); 56 53 57 static pthread_key_t inotify_key; 54 58 static pthread_once_t inotify_key_once = PTHREAD_ONCE_INIT; … … 122 126 int watch; 123 127 int flag; 128 int class; 129 unsigned long check_mask; 124 130 char * file; 125 131 } sh_watch; … … 190 196 #define SH_INOTIFY_MODIFY 1 191 197 192 static void sh_inotify_init(sh_watches * watches) 193 { 198 void sh_inotify_init(sh_watches * watches) 199 { 200 SH_MUTEX_LOCK_UNSAFE(mutex_watches); 194 201 watches->list_of_watches = NULL; 195 202 watches->count = 0; 196 203 watches->max_count = 0; 204 SH_MUTEX_UNLOCK_UNSAFE(mutex_watches); 205 206 SH_MUTEX_LOCK_UNSAFE(mutex_list_dormant); 207 watches->dormant_watches = NULL; 208 SH_MUTEX_UNLOCK_UNSAFE(mutex_list_dormant); 209 197 210 return; 211 } 212 213 ssize_t sh_inotify_read(char * buffer, size_t count) 214 { 215 ssize_t len; 216 int ifd = sh_inotify_getfd(); 217 218 do { 219 len = read (ifd, &buffer, count); 220 } while (len < 0 || errno == EINTR); 221 222 return len; 198 223 } 199 224 … … 226 251 }; 227 252 253 static void sh_inotify_listitem_destroy(struct sh_inotify_litem * this) 254 { 255 if (this) 256 SH_FREE(this); 257 return; 258 } 259 260 /* No Mutex in the list cursor functions, must be in the caller 261 * function... 262 */ 228 263 typedef struct { 229 264 struct sh_inotify_litem *prenode; … … 231 266 } sh_inotify_listCursor; 232 267 233 static sh_watch * sh_inotify_list_first(sh_inotify_listCursor * listcursor, sh_watches * watches) 268 static sh_watch * sh_inotify_list_first(sh_inotify_listCursor * listcursor, 269 sh_watches * watches) 234 270 { 235 271 listcursor->prenode = watches->dormant_watches; 236 272 listcursor->curnode = watches->dormant_watches; 237 238 return listcursor->curnode->watch;239 }240 241 static sh_watch * sh_inotify_list_next(sh_inotify_listCursor * listcursor, sh_watches * watches)242 {243 (void) watches;244 245 listcursor->prenode = listcursor->curnode;246 listcursor->curnode = listcursor->curnode->next;247 273 248 274 if (listcursor->curnode) … … 251 277 } 252 278 253 static void sh_inotify_listitem_destroy(struct sh_inotify_litem * this) 254 { 255 SH_FREE(this); 256 return; 257 } 258 259 static sh_watch * sh_inotify_list_del_current(sh_inotify_listCursor * listcursor, sh_watches * watches) 279 static sh_watch * sh_inotify_list_next(sh_inotify_listCursor * listcursor, 280 sh_watches * watches) 281 { 282 (void) watches; 283 284 listcursor->prenode = listcursor->curnode; 285 286 if (listcursor->curnode) 287 { 288 listcursor->curnode = listcursor->curnode->next; 289 return listcursor->curnode->watch; 290 } 291 292 return NULL; 293 } 294 295 static sh_watch * sh_inotify_list_del_cur(sh_inotify_listCursor * listcursor, 296 sh_watches * watches) 260 297 { 261 298 sh_watch * ret = NULL; … … 277 314 listcursor->curnode = this->next; 278 315 } 279 ret = listcursor->curnode->watch; 316 if (listcursor->curnode) 317 ret = listcursor->curnode->watch; 318 else 319 ret = NULL; 280 320 sh_inotify_listitem_destroy(this); 281 321 } … … 285 325 static int sh_inotify_add_dormant(sh_watches * watches, sh_watch * item) 286 326 { 287 struct sh_inotify_litem * this = SH_ALLOC(sizeof(struct sh_inotify_litem)); 327 struct sh_inotify_litem * this; 328 329 SH_MUTEX_LOCK(mutex_list_dormant); 330 this = SH_ALLOC(sizeof(struct sh_inotify_litem)); 288 331 289 332 this->watch = item; … … 291 334 292 335 watches->dormant_watches = this; 336 SH_MUTEX_UNLOCK(mutex_list_dormant); 293 337 return 0; 338 } 339 340 static void * sh_dummy_popret = NULL; 341 342 char * sh_inotify_pop_dormant(sh_watches * watches, 343 int * class, unsigned long * check_mask) 344 { 345 char * popret = NULL; 346 struct sh_inotify_litem * this; 347 348 /* Take the address to keep gcc from putting it into a register. 349 * Avoids the 'clobbered by longjmp' warning. 350 */ 351 sh_dummy_popret = (void *) &popret; 352 353 SH_MUTEX_LOCK(mutex_list_dormant); 354 355 this = (struct sh_inotify_litem *) watches->dormant_watches; 356 357 if (this) 358 { 359 *class = this->watch->class; 360 *check_mask = this->watch->check_mask; 361 popret = sh_util_strdup(this->watch->file); 362 363 watches->dormant_watches = this->next; 364 365 sh_inotify_free_watch(this->watch); 366 SH_FREE(this); 367 } 368 SH_MUTEX_UNLOCK(mutex_list_dormant); 369 370 return popret; 371 } 372 373 void sh_inotify_purge_dormant(sh_watches * watches) 374 { 375 struct sh_inotify_litem * this; 376 377 SH_MUTEX_LOCK(mutex_list_dormant); 378 this = (struct sh_inotify_litem *) watches->dormant_watches; 379 380 watches->dormant_watches = NULL; 381 382 while (this) 383 { 384 struct sh_inotify_litem * cur = this; 385 386 this = this->next; 387 388 sh_inotify_free_watch(cur->watch); 389 SH_FREE(cur); 390 } 391 SH_MUTEX_UNLOCK(mutex_list_dormant); 392 return; 294 393 } 295 394 … … 308 407 { 309 408 int ifd = sh_inotify_getfd(); 310 zAVLTree * all_watches = (zAVLTree *)(watches->list_of_watches); 409 zAVLTree * all_watches; 410 411 SH_MUTEX_LOCK(mutex_watches); 412 all_watches = (zAVLTree *)(watches->list_of_watches); 311 413 312 414 if (all_watches) 313 415 zAVLFreeTree(all_watches, sh_inotify_free_watch); 314 416 315 sh_inotify_init(watches); 417 watches->list_of_watches = NULL; 418 watches->count = 0; 419 SH_MUTEX_UNLOCK(mutex_watches); 316 420 317 421 if (ifd >= 0) 318 422 close(ifd); 319 423 sh_set_inotify_fd(-1); 320 321 watches->count = 0;322 424 323 425 return; … … 345 447 } 346 448 449 #define SH_INOTIFY_FILEFLAGS \ 450 (IN_ATTRIB|IN_MODIFY|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT) 451 #define SH_INOTIFY_DIRFLAGS \ 452 (SH_INOTIFY_FILEFLAGS|IN_DELETE|IN_CREATE|IN_MOVED_FROM|IN_MOVED_TO) 453 454 #define SH_INOTIFY_FLAGS (SH_INOTIFY_FILEFLAGS|SH_INOTIFY_DIRFLAGS) 455 456 /* Create an item and put it on the 'dormant' list for later watch creation 457 */ 458 int sh_inotify_add_watch_later(char * filename, sh_watches * watches, 459 int * errnum, 460 int class, unsigned long check_mask) 461 { 462 sh_watch * item; 463 464 item = sh_inotify_create_watch(filename, -1, /* flag */ 0); 465 466 item->class = class; 467 item->check_mask = check_mask; 468 469 sh_inotify_add_dormant(watches, item); 470 if (errnum) 471 *errnum = 0; 472 473 return 0; 474 } 475 476 int sh_inotify_rm_watch (sh_watches * watches, sh_watches * save, int wd) 477 { 478 int ifd = sh_get_inotify_fd(); 479 480 if (watches) 481 { 482 sh_watch * item; 483 484 SH_MUTEX_LOCK(mutex_watches); 485 item = zAVLSearch(watches->list_of_watches, &wd); 486 487 if (item) 488 { 489 zAVLDelete(watches->list_of_watches, &wd); 490 if (save) /* optionally save the item */ 491 { 492 item->watch = -1; 493 sh_inotify_add_dormant(save, item); 494 } 495 else 496 { 497 sh_inotify_free_watch(item); 498 } 499 } 500 SH_MUTEX_UNLOCK(mutex_watches); 501 } 502 return inotify_rm_watch(ifd, wd); 503 } 504 505 #if (defined(SH_WITH_CLIENT) || defined(SH_STANDALONE)) 506 static void * sh_dummy_litem; 507 508 int sh_inotify_recheck_watches (sh_watches * watches, sh_watches * save) 509 { 510 sh_watch * litem; 511 sh_inotify_listCursor listcursor; 512 int ifd = sh_get_inotify_fd(); 513 514 extern void sh_fInotify_report_add(char * path, int class, unsigned long check_mask); 515 516 sh_dummy_litem = (void*) &litem; 517 518 /* -- Check dormant watches for reopening. 519 */ 520 SH_MUTEX_LOCK(mutex_list_dormant); 521 522 for (litem = sh_inotify_list_first(&listcursor, save); litem; 523 litem = sh_inotify_list_next(&listcursor, save)) 524 { 525 have_next: 526 527 /* sh_inotify_list_del_cur may return NULL */ 528 if (litem && litem->file && litem->watch == -1) 529 { 530 litem->watch = inotify_add_watch (ifd, litem->file, 531 SH_INOTIFY_FLAGS); 532 533 if (litem->watch >= 0) 534 { 535 SH_MUTEX_LOCK(mutex_watches); 536 if (watches->list_of_watches) 537 zAVLInsert(watches->list_of_watches, litem); 538 SH_MUTEX_UNLOCK(mutex_watches); 539 540 sh_fInotify_report_add(litem->file, litem->class, litem->check_mask); 541 542 litem = sh_inotify_list_del_cur(&listcursor, save); 543 544 goto have_next; 545 } 546 } 547 } 548 SH_MUTEX_UNLOCK(mutex_list_dormant); 549 return 0; 550 } 551 #endif 552 347 553 /* This function is idempotent; it will add the watch only once 348 554 */ 349 int sh_inotify_add_watch(char * filename, sh_watches * watches, int * errnum) 350 { 555 int sh_inotify_add_watch(char * filename, sh_watches * watches, int * errnum, 556 int class, unsigned long check_mask) 557 { 558 volatile int retval = 0; 559 560 SH_MUTEX_LOCK(mutex_watches); 561 351 562 *errnum = 0; 352 563 … … 375 586 376 587 nwatch = inotify_add_watch (ifd, filename, 377 IN_MODIFY|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT);588 SH_INOTIFY_FLAGS); 378 589 if (nwatch < 0) 379 590 { 380 591 *errnum = errno; 381 return -1; 592 retval = -1; 593 goto retpoint; 382 594 } 383 595 384 596 item = sh_inotify_create_watch(filename, nwatch, /* flag */ 0); 597 598 item->class = class; 599 item->check_mask = check_mask; 385 600 386 601 if (NULL == watches->list_of_watches) 387 watches->list_of_watches = zAVLAllocTree (sh_inotify_getkey, zAVL_KEY_INT); 602 watches->list_of_watches = zAVLAllocTree (sh_inotify_getkey, 603 zAVL_KEY_INT); 388 604 389 605 if (watches->list_of_watches) 390 606 { 391 *errnum = zAVLInsert((zAVLTree *)(watches->list_of_watches), item); 607 *errnum = zAVLInsert((zAVLTree *)(watches->list_of_watches), 608 item); 609 392 610 if (*errnum != 0) 393 611 { 612 (*errnum == -1) ? *errnum = ENOMEM : EEXIST; 394 613 sh_inotify_free_watch(item); 395 return -1; 614 retval = -1; 615 goto retpoint; 396 616 } 397 617 } 398 618 else 399 619 { 400 *errnum = -1; 401 return -1; 620 *errnum = ENOMEM; 621 retval = -1; 622 goto retpoint; 402 623 } 403 624 … … 405 626 } 406 627 } 407 return 0; 408 } 628 retpoint: 629 SH_MUTEX_UNLOCK(mutex_watches); 630 return retval; 631 } 632 633 static void * sh_dummy_sret = NULL; 634 635 char * sh_inotify_search_item(sh_watches * watches, int watch, 636 int * class, unsigned long * check_mask) 637 { 638 sh_watch * item; 639 char * sret = NULL; 640 641 /* Take the address to keep gcc from putting it into a register. 642 * Avoids the 'clobbered by longjmp' warning. 643 */ 644 sh_dummy_sret = (void *) &sret; 645 646 SH_MUTEX_LOCK(mutex_watches); 647 item = zAVLSearch(watches->list_of_watches, &watch); 648 649 if (item) 650 { 651 *class = item->class; 652 *check_mask = item->check_mask; 653 sret = sh_util_strdup(item->file); 654 } 655 SH_MUTEX_UNLOCK(mutex_watches); 656 return sret; 657 } 658 659 static void * sh_dummy_litem = NULL; 409 660 410 661 int sh_inotify_wait_for_change(char * filename, sh_watches * watches, 411 662 int * errnum, int waitsec) 412 663 { 413 sh_watch * item;414 zAVLTree * all_watches = (zAVLTree *)(watches->list_of_watches);664 sh_watch * litem; 665 sh_watch * zitem; 415 666 int ifd = sh_inotify_getfd(); 416 667 668 /* Take the address to keep gcc from putting it into a register. 669 * Avoids the 'clobbered by longjmp' warning. 670 */ 671 sh_dummy_litem = (void*) &litem; 672 417 673 *errnum = 0; 418 674 … … 421 677 if (ifd >= 0) 422 678 { 679 volatile ssize_t i = 0; 423 680 ssize_t len = -1; 424 ssize_t i = 0;425 681 int flag = 0; 426 682 char buffer[1024]; … … 432 688 if (filename) 433 689 { 434 if (sh_inotify_add_watch(filename, watches, errnum ) < 0)690 if (sh_inotify_add_watch(filename, watches, errnum, 0, 0) < 0) 435 691 { 436 692 retry_msleep(waitsec, 0); … … 441 697 /* -- Check dormant watches for reopening. 442 698 */ 443 for (item = sh_inotify_list_first(&listcursor, watches); item; 444 item = sh_inotify_list_next(&listcursor, watches)) 699 SH_MUTEX_LOCK(mutex_list_dormant); 700 701 for (litem = sh_inotify_list_first(&listcursor, watches); litem; 702 litem = sh_inotify_list_next(&listcursor, watches)) 445 703 { 446 704 have_next: 447 if (item->file && item->watch == -1) 705 /* sh_inotify_list_del_cur may return NULL */ 706 if (litem && litem->file && litem->watch == -1) 448 707 { 449 item->watch = inotify_add_watch (ifd, item->file, 450 IN_MODIFY|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT); 451 if (item->watch >= 0) 708 litem->watch = inotify_add_watch (ifd, litem->file, 709 SH_INOTIFY_FLAGS); 710 711 if (litem->watch >= 0) 452 712 { 453 zAVLInsert(all_watches, item); 454 item = sh_inotify_list_del_current(&listcursor, watches); 713 SH_MUTEX_LOCK(mutex_watches); 714 if (watches->list_of_watches) 715 zAVLInsert(watches->list_of_watches, litem); 716 SH_MUTEX_UNLOCK(mutex_watches); 717 litem = sh_inotify_list_del_cur(&listcursor, watches); 455 718 goto have_next; 456 719 } 457 720 } 458 721 } 722 SH_MUTEX_UNLOCK(mutex_list_dormant); 459 723 460 724 461 725 /* -- Blocking read on inotify file descriptor 462 726 */ 463 do { 464 len = read (ifd, &buffer, sizeof(buffer)); 465 } while (len < 0 || errno == EINTR); 727 sh_inotify_read(buffer, sizeof(buffer)); 466 728 467 729 if (len > 0) … … 475 737 event = (struct inotify_event *) &buffer[i]; 476 738 477 item = zAVLSearch(all_watches, &(event->wd)); 478 479 if (item) 739 SH_MUTEX_LOCK(mutex_watches); 740 zitem = zAVLSearch(watches->list_of_watches, &(event->wd)); 741 742 if (zitem) 480 743 { 481 744 if (event->mask & IN_MODIFY) 482 745 { 483 item->flag |= SH_INOTIFY_MODIFY;746 zitem->flag |= SH_INOTIFY_MODIFY; 484 747 flag |= SH_INOTIFY_MODIFY; 485 748 } … … 488 751 event->mask & IN_MOVE_SELF ) 489 752 { 490 item->flag |= SH_INOTIFY_REOPEN;491 (void) inotify_rm_watch(ifd, item->watch);492 zAVLDelete( all_watches,item);493 sh_inotify_add_dormant(watches, item);494 item->watch = -1;753 zitem->flag |= SH_INOTIFY_REOPEN; 754 (void) inotify_rm_watch(ifd, zitem->watch); 755 zAVLDelete(watches->list_of_watches, zitem); 756 sh_inotify_add_dormant(watches, zitem); 757 zitem->watch = -1; 495 758 flag |= SH_INOTIFY_REOPEN; 496 759 } 497 760 } 761 SH_MUTEX_UNLOCK(mutex_watches); 498 762 499 763 i += sizeof (struct inotify_event) + event->len; … … 527 791 } 528 792 793 529 794 /* !defined(HAVE_SYS_INOTIFY_H) */ 530 795 #else … … 553 818 } 554 819 555 int sh_inotify_add_watch(char * filename, sh_watches * watches, int * errnum) 820 int sh_inotify_add_watch(char * filename, sh_watches * watches, int * errnum, 821 int class, unsigned long check_mask) 556 822 { 557 823 (void) filename; 558 824 (void) watches; 825 (void) class; 826 (void) check_mask; 559 827 *errnum = 0; 560 828 return 0; 561 829 } 562 830 831 int sh_inotify_add_watch_later(char * filename, sh_watches * watches, 832 int * errnum, 833 int class, unsigned long check_mask) 834 { 835 (void) filename; 836 (void) watches; 837 (void) class; 838 (void) check_mask; 839 *errnum = 0; 840 return 0; 841 } 842 563 843 #endif 844 845 #ifdef SH_CUTEST 846 #include "CuTest.h" 847 void Test_inotify(CuTest *tc) { 848 #if defined(HAVE_SYS_INOTIFY_H) && (defined(SH_WITH_CLIENT) || defined(SH_STANDALONE)) 849 850 int ret; 851 sh_watches twatch = SH_INOTIFY_INITIALIZER; 852 sh_watch * litem; 853 sh_inotify_listCursor listcursor; 854 char * p; 855 int class; 856 unsigned long check_mask; 857 int nrun = 0; 858 859 sh_watch aw1 = { -1, 0, 1, 1, "a1" }; 860 sh_watch aw2 = { -1, 0, 2, 1, "a2" }; 861 sh_watch aw3 = { 2, 0, 3, 1, "a3" }; 862 sh_watch aw4 = { -1, 0, 4, 1, "a4" }; 863 sh_watch aw5 = { 5, 0, 5, 1, "a5" }; 864 865 do { 866 867 int count = 0; 868 869 sh_watch * w1 = SH_ALLOC(sizeof(sh_watch)); 870 sh_watch * w2 = SH_ALLOC(sizeof(sh_watch)); 871 sh_watch * w3 = SH_ALLOC(sizeof(sh_watch)); 872 sh_watch * w4 = SH_ALLOC(sizeof(sh_watch)); 873 sh_watch * w5 = SH_ALLOC(sizeof(sh_watch)); 874 875 memcpy(w1, &aw1, sizeof(sh_watch)); 876 w1->file = sh_util_strdup(aw1.file); 877 memcpy(w2, &aw2, sizeof(sh_watch)); 878 w2->file = sh_util_strdup(aw2.file); 879 memcpy(w3, &aw3, sizeof(sh_watch)); 880 w3->file = sh_util_strdup(aw3.file); 881 memcpy(w4, &aw4, sizeof(sh_watch)); 882 w4->file = sh_util_strdup(aw4.file); 883 memcpy(w5, &aw5, sizeof(sh_watch)); 884 w5->file = sh_util_strdup(aw5.file); 885 886 ret = sh_inotify_add_dormant(&twatch, w1); 887 CuAssertIntEquals(tc, ret, 0); 888 ret = sh_inotify_add_dormant(&twatch, w2); 889 CuAssertIntEquals(tc, ret, 0); 890 ret = sh_inotify_add_dormant(&twatch, w3); 891 CuAssertIntEquals(tc, ret, 0); 892 ret = sh_inotify_add_dormant(&twatch, w4); 893 CuAssertIntEquals(tc, ret, 0); 894 ret = sh_inotify_add_dormant(&twatch, w5); 895 CuAssertIntEquals(tc, ret, 0); 896 897 /* -- Check dormant watches for reopening. 898 */ 899 for (litem = sh_inotify_list_first(&listcursor, &twatch); litem; 900 litem = sh_inotify_list_next(&listcursor, &twatch)) 901 { 902 have_next: 903 904 /* sh_inotify_list_del_cur may return NULL */ 905 if (litem) 906 { 907 ++count; 908 909 if (litem->file && litem->watch == -1) 910 { 911 912 switch (litem->class) 913 { 914 case 1: 915 CuAssertStrEquals(tc, litem->file, "a1"); 916 break; 917 case 2: 918 CuAssertStrEquals(tc, litem->file, "a2"); 919 break; 920 case 3: 921 CuAssertStrEquals(tc, litem->file, "deadbeef"); 922 break; 923 case 4: 924 CuAssertStrEquals(tc, litem->file, "a4"); 925 break; 926 case 5: 927 CuAssertStrEquals(tc, litem->file, "deadbeef"); 928 break; 929 default: 930 CuAssertStrEquals(tc, litem->file, "deadbeef"); 931 } 932 litem = sh_inotify_list_del_cur(&listcursor, &twatch); 933 goto have_next; 934 } 935 switch (litem->class) 936 { 937 case 3: 938 CuAssertStrEquals(tc, litem->file, "a3"); 939 break; 940 case 5: 941 CuAssertStrEquals(tc, litem->file, "a5"); 942 break; 943 default: 944 CuAssertStrEquals(tc, litem->file, "foobar"); 945 } 946 } 947 } 948 949 CuAssertIntEquals(tc, count, 5); 950 951 p = sh_inotify_pop_dormant(&twatch, &class, &check_mask); 952 CuAssertStrEquals(tc, p, "a5"); 953 954 p = sh_inotify_pop_dormant(&twatch, &class, &check_mask); 955 CuAssertStrEquals(tc, p, "a3"); 956 CuAssertIntEquals(tc, class, 3); 957 958 p = sh_inotify_pop_dormant(&twatch, &class, &check_mask); 959 CuAssertTrue(tc, NULL == p); 960 CuAssertTrue(tc, NULL == twatch.dormant_watches); 961 962 ++nrun; 963 964 } while (nrun < 100); 965 966 #else 967 (void) tc; 968 #endif 969 970 return; 971 } 972 #endif -
trunk/src/sh_modules.c
r294 r367 18 18 #include "sh_logmon.h" 19 19 #include "sh_registry.h" 20 #include "sh_fInotify.h" 20 21 21 22 sh_mtype modList[] = { … … 173 174 #endif 174 175 176 #if defined(HAVE_SYS_INOTIFY_H) 177 { 178 N_("INOTIFY"), 179 -1, 180 SH_MODFL_NOTIMER, 181 sh_fInotify_init, 182 sh_fInotify_timer, 183 sh_fInotify_run, 184 sh_fInotify_cleanup, 185 sh_fInotify_reconf, 186 187 N_("[Inotify]"), 188 sh_fInotify_table, 189 PTHREAD_MUTEX_INITIALIZER, 190 }, 191 #endif 192 175 193 { 176 194 NULL, -
trunk/src/sh_readconf.c
r347 r367 31 31 #include "sh_error.h" 32 32 #include "sh_extern.h" 33 #include "sh_unix.h" 33 34 #include "sh_files.h" 34 35 #include "sh_forward.h" … … 46 47 #include "sh_tiger.h" 47 48 #include "sh_tools.h" 48 #include "sh_unix.h"49 49 #include "sh_utils.h" 50 50 #include "sh_restrict.h" -
trunk/src/sh_unix.c
r362 r367 3585 3585 #endif 3586 3586 3587 3588 static void * sh_dummy_filename; 3589 static void * sh_dummy_tmp; 3590 static void * sh_dummy_tmp2; 3591 3587 3592 int sh_unix_getinfo (int level, char * filename, file_type * theFile, 3588 3593 char * fileHash, int policy) … … 3593 3598 struct stat lbuf; 3594 3599 struct stat fbuf; 3595 intstat_return;3596 intstat_errno = 0;3600 volatile int stat_return; 3601 volatile int stat_errno = 0; 3597 3602 3598 3603 ShFileType type; … … 3602 3607 3603 3608 char * linknamebuf; 3604 intlinksize;3609 volatile int linksize; 3605 3610 3606 3611 extern int get_the_fd (SL_TICKET ticket); 3607 3612 3608 SL_TICKET rval_open;3609 int err_open = 0;3610 3611 int fd;3612 int fstat_return;3613 int fstat_errno = 0;3614 int try = 0;3613 volatile SL_TICKET rval_open; 3614 volatile int err_open = 0; 3615 3616 volatile int fd; 3617 volatile int fstat_return; 3618 volatile int fstat_errno = 0; 3619 volatile int try = 0; 3615 3620 3616 3621 sh_string * content = NULL; … … 3622 3627 char * path = NULL; 3623 3628 3624 int alert_timeout = 120;3629 volatile int alert_timeout = 120; 3625 3630 3626 3631 path = theFile->fullpath; 3627 3632 3628 3633 SL_ENTER(_("sh_unix_getinfo")); 3634 3635 /* Take the address to keep gcc from putting it into a register. 3636 * Avoids the 'clobbered by longjmp' warning. 3637 */ 3638 sh_dummy_filename = (void *) &filename; 3639 sh_dummy_tmp = (void *) &tmp; 3640 sh_dummy_tmp2 = (void *) &tmp2; 3629 3641 3630 3642 /* --- Stat the file, and get checksum. --- … … 3656 3668 if (stale) 3657 3669 { 3670 SH_MUTEX_LOCK(mutex_thread_nolog); 3658 3671 sh_error_handle(SH_ERR_ERR, FIL__, __LINE__, err_open, MSG_E_SUBGEN, 3659 3672 stale, _("sh_unix_getinfo_open")); 3673 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3660 3674 } 3661 3675 … … 3688 3702 { 3689 3703 tmp2 = sh_util_safe_name (theFile->fullpath); 3704 SH_MUTEX_LOCK(mutex_thread_nolog); 3690 3705 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_FI_TOOLATE, 3691 3706 (long)(tend - tstart), tmp2); 3707 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3692 3708 SH_FREE(tmp2); 3693 3709 } … … 3707 3723 if (stale) 3708 3724 { 3725 SH_MUTEX_LOCK(mutex_thread_nolog); 3709 3726 sh_error_handle(SH_ERR_ERR, FIL__, __LINE__, fstat_errno, 3710 3727 MSG_E_SUBGEN, 3711 3728 stale, _("sh_unix_getinfo_fstat")); 3729 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3712 3730 } 3713 3731 … … 3742 3760 (void) sl_get_euid(&euid); 3743 3761 tmp2 = sh_util_safe_name (theFile->fullpath); 3762 SH_MUTEX_LOCK(mutex_thread_nolog); 3744 3763 sh_error_handle (level, FIL__, __LINE__, stat_return, MSG_FI_STAT, 3745 3764 _("lstat"), … … 3747 3766 (long) euid, 3748 3767 tmp2); 3768 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3749 3769 SH_FREE(tmp2); 3750 3770 } … … 3894 3914 (void) sl_get_euid(&euid); 3895 3915 3916 SH_MUTEX_LOCK(mutex_thread_nolog); 3896 3917 sh_error_handle (level, FIL__, __LINE__, stat_return, MSG_FI_STAT, 3897 3918 _("fstat"), … … 3899 3920 (long) euid, 3900 3921 tmp2); 3922 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3901 3923 } 3902 3924 else if (fd >= 0 && !S_ISREG(fbuf.st_mode)) 3903 3925 { 3926 SH_MUTEX_LOCK(mutex_thread_nolog); 3904 3927 sh_error_handle (level, FIL__, __LINE__, fstat_errno, 3905 3928 MSG_E_NOTREG, tmp2); 3929 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3906 3930 } 3907 3931 else … … 3911 3935 sl_strlcpy(errbuf, sl_error_string(rval_open), sizeof(errbuf)); 3912 3936 sh_error_message(err_open, errbuf2, sizeof(errbuf2)); 3937 SH_MUTEX_LOCK(mutex_thread_nolog); 3913 3938 sh_error_handle (level, FIL__, __LINE__, err_open, 3914 3939 MSG_E_READ, errbuf, errbuf2, tmp2); 3940 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3915 3941 } 3916 3942 SH_FREE(tmp2); … … 4004 4030 if (policy == SH_LEVEL_ALLIGNORE) 4005 4031 { 4032 SH_MUTEX_LOCK(mutex_thread_nolog); 4006 4033 sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, ENOENT, 4007 4034 MSG_FI_NOGRP, 4008 4035 (long) buf.st_gid, tmp2); 4036 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4009 4037 } 4010 4038 else 4011 4039 { 4040 SH_MUTEX_LOCK(mutex_thread_nolog); 4012 4041 sh_error_handle (ShDFLevel[SH_ERR_T_NAME], FIL__, __LINE__, ENOENT, 4013 4042 MSG_FI_NOGRP, 4014 4043 (long) buf.st_gid, tmp2); 4044 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4015 4045 } 4016 4046 SH_FREE(tmp2); … … 4025 4055 if (policy == SH_LEVEL_ALLIGNORE) 4026 4056 { 4057 SH_MUTEX_LOCK(mutex_thread_nolog); 4027 4058 sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, ENOENT, 4028 4059 MSG_FI_NOUSR, 4029 4060 (long) buf.st_uid, tmp2); 4061 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4030 4062 } 4031 4063 else 4032 4064 { 4065 SH_MUTEX_LOCK(mutex_thread_nolog); 4033 4066 sh_error_handle (ShDFLevel[SH_ERR_T_NAME], FIL__, __LINE__, ENOENT, 4034 4067 MSG_FI_NOUSR, 4035 4068 (long) buf.st_uid, tmp2); 4069 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4036 4070 } 4037 4071 SH_FREE(tmp2); … … 4046 4080 theFile->fullpath : filename); 4047 4081 (void) sh_unix_time(theFile->mtime, timestr, sizeof(timestr)); 4082 SH_MUTEX_LOCK(mutex_thread_nolog); 4048 4083 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_FI_LIST, 4049 4084 theFile->c_mode, … … 4054 4089 timestr, 4055 4090 tmp2); 4091 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4056 4092 SH_FREE(tmp2); 4057 4093 } … … 4076 4112 linksize = errno; 4077 4113 tmp2 = sh_util_safe_name (theFile->fullpath); 4114 SH_MUTEX_LOCK(mutex_thread_nolog); 4078 4115 sh_error_handle (level, FIL__, __LINE__, linksize, MSG_FI_RDLNK, 4079 4116 sh_error_message (linksize, errbuf, sizeof(errbuf)), tmp2); 4117 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4080 4118 SH_FREE(tmp2); 4081 4119 SH_FREE(linknamebuf); … … 4130 4168 4131 4169 (void) sl_get_euid(&euid); 4170 SH_MUTEX_LOCK(mutex_thread_nolog); 4132 4171 sh_error_handle (level, FIL__, __LINE__, stat_return, 4133 4172 MSG_FI_STAT, … … 4136 4175 (long) euid, 4137 4176 tmp2); 4177 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4138 4178 } 4139 4179 else … … 4141 4181 /* a dangling link -- everybody seems to have plenty of them 4142 4182 */ 4183 SH_MUTEX_LOCK(mutex_thread_nolog); 4143 4184 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_FI_DLNK, 4144 4185 tmp, tmp2); 4186 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4145 4187 } 4146 4188 theFile->linkisok = BAD; … … 4175 4217 { 4176 4218 tmp2 = sh_util_safe_name (linknamebuf); 4219 SH_MUTEX_LOCK(mutex_thread_nolog); 4177 4220 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_FI_LLNK, 4178 4221 theFile->link_c_mode, tmp2); 4222 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4179 4223 SH_FREE(tmp2); 4180 4224 } … … 4213 4257 _("compressed file too large (%lu bytes)"), 4214 4258 clen); 4259 SH_MUTEX_LOCK(mutex_thread_nolog); 4215 4260 sh_error_handle (SH_ERR_WARN, FIL__, __LINE__, -1, 4216 4261 MSG_E_SUBGPATH, tmsg, 4217 4262 _("sh_unix_getinfo"), tpath); 4263 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4218 4264 SH_FREE(tpath); 4219 4265 } -
trunk/test/testhash.sh
r354 r367 58 58 fi 59 59 # 60 ${TOP_SRCDIR}/configure --quiet $TRUST --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file --enable-db-reload --enable-debug '--enable-login-watch' '--enable-mounts-check' ${C_LOGFILE} '--enable-process-check''--enable-port-check' '--enable-suidcheck' '--with-rnd=unix'60 ${TOP_SRCDIR}/configure --quiet $TRUST --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file --enable-db-reload '--enable-login-watch' '--enable-mounts-check' ${C_LOGFILE} '--enable-port-check' '--enable-suidcheck' '--with-rnd=unix' 61 61 # 62 62 fail=0
Note:
See TracChangeset
for help on using the changeset viewer.