Changeset 138


Ignore:
Timestamp:
Oct 28, 2007, 4:55:19 PM (12 years ago)
Author:
rainer
Message:

More fixes for compile and runtime errors.

Location:
trunk
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.in

    r126 r138  
    117117        rijndael-boxes-fst.h sh_socket.h sh_ignore.h sh_prelude.h \
    118118        sh_mounts.h sh_userfiles.h sh_static.h sh_prelink.h \
    119         sh_processcheck.h sh_portcheck.h
     119        sh_processcheck.h sh_portcheck.h sh_pthread.h
    120120
    121121
     
    150150        $(srcsrc)/sh_prelink.c $(srcsrc)/sh_static.c \
    151151        $(srcsrc)/sh_portcheck.c \
    152         $(srcsrc)/sh_processcheck.c $(srcsrc)/sh_prelude_old.c
     152        $(srcsrc)/sh_processcheck.c $(srcsrc)/sh_prelude_old.c \
     153        $(srcsrc)/sh_pthread.c
    153154
    154155OBJECTS = sh_files.o sh_tiger0.o sh_tiger2.o sh_tiger2_64.o \
     
    163164        zAVLTree.o sh_socket.o sh_ignore.o sh_prelude.o \
    164165        sh_mounts.o sh_userfiles.o sh_prelink.o sh_static.o \
    165         sh_processcheck.o sh_portcheck.o sh_prelude_old.o 
     166        sh_processcheck.o sh_portcheck.o sh_prelude_old.o \
     167        sh_pthread.o
    166168
    167169KERN = kern_head.h kern_head.c
     
    16331635
    16341636
    1635 samhain.o: $(srcsrc)/samhain.c Makefile config_xor.h $(srcinc)/samhain.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_mail.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
    1636 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_tiger.h $(srcinc)/sh_prelink.h $(srcinc)/sh_static.h $(srcinc)/sh_prelude.h $(srcinc)/sh_ignore.h
    1637 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
     1637samhain.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_mail.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
     1638sh_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_tiger.h $(srcinc)/sh_prelink.h $(srcinc)/sh_pthread.h $(srcinc)/sh_static.h $(srcinc)/sh_prelude.h $(srcinc)/sh_ignore.h
     1639sh_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
    16381640sh_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_mail.h $(srcinc)/sh_forward.h $(srcinc)/sh_prelude.h $(srcinc)/sh_tools.h $(srcinc)/sh_extern.h
    1639 sh_files.o: $(srcsrc)/sh_files.c Makefile config_xor.h $(srcinc)/samhain.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
     1641sh_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
    16401642sh_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.h
    16411643sh_readconf.o: $(srcsrc)/sh_readconf.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_database.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_files.h $(srcinc)/sh_mail.h $(srcinc)/sh_calls.h $(srcinc)/sh_tiger.h $(srcinc)/sh_forward.h $(srcinc)/sh_modules.h $(srcinc)/sh_gpg.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_prelink.h $(srcinc)/sh_extern.h $(srcinc)/sh_database.h $(srcinc)/sh_prelude.h
    1642 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
     1644sh_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
    16431645sh_tiger1.o: $(srcsrc)/sh_tiger1.c Makefile config_xor.h
    16441646sh_tiger2.o: $(srcsrc)/sh_tiger2.c Makefile config_xor.h
     
    16461648sh_tiger2_64.o: $(srcsrc)/sh_tiger2_64.c Makefile config_xor.h
    16471649sh_hash.o: $(srcsrc)/sh_hash.c Makefile config_xor.h $(srcinc)/sh_hash.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_tiger.h $(srcinc)/sh_gpg.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_ignore.h $(srcinc)/sh_forward.h $(srcinc)/sh_hash.h
    1648 sh_mail.o: $(srcsrc)/sh_mail.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_mail.h $(srcinc)/sh_utils.h $(srcinc)/sh_fifo.h $(srcinc)/sh_tools.h $(srcinc)/sh_static.h $(srcinc)/sh_tools.h
    1649 sh_mem.o: $(srcsrc)/sh_mem.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h
    1650 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_static.h
     1650sh_mail.o: $(srcsrc)/sh_mail.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_mail.h $(srcinc)/sh_utils.h $(srcinc)/sh_fifo.h $(srcinc)/sh_tools.h $(srcinc)/sh_pthread.h $(srcinc)/sh_static.h $(srcinc)/sh_tools.h
     1651sh_mem.o: $(srcsrc)/sh_mem.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_pthread.h
     1652sh_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
    16511653sh_forward.o: $(srcsrc)/sh_forward.c Makefile config_xor.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_mail.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
    16521654sh_modules.o: $(srcsrc)/sh_modules.c Makefile config_xor.h $(srcinc)/sh_modules.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
    16531655sh_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
    1654 sh_kern.o: $(srcsrc)/sh_kern.c Makefile config_xor.h $(srcinc)/samhain.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
    1655 sh_suidchk.o: $(srcsrc)/sh_suidchk.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_modules.h $(srcinc)/sh_suidchk.h $(srcinc)/sh_hash.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_schedule.h $(srcinc)/sh_calls.h
     1656sh_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
     1657sh_suidchk.o: $(srcsrc)/sh_suidchk.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_suidchk.h $(srcinc)/sh_hash.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_schedule.h $(srcinc)/sh_calls.h
    16561658sh_srp.o: $(srcsrc)/sh_srp.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_tiger.h $(srcinc)/sh_mem.h $(srcinc)/sh_utils.h $(srcinc)/sh_srp.h $(srcinc)/bignum.h
    16571659sh_fifo.o: $(srcsrc)/sh_fifo.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_unix.h
    1658 sh_tools.o: $(srcsrc)/sh_tools.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error.h $(srcinc)/sh_tools.h $(srcinc)/sh_utils.h $(srcinc)/sh_tiger.h $(srcinc)/sh_static.h $(srcinc)/rijndael-api-fst.h $(srcinc)/rijndael-api-fst.h
     1660sh_tools.o: $(srcsrc)/sh_tools.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error.h $(srcinc)/sh_tools.h $(srcinc)/sh_utils.h $(srcinc)/sh_tiger.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h $(srcinc)/rijndael-api-fst.h $(srcinc)/rijndael-api-fst.h
    16591661sh_html.o: $(srcsrc)/sh_html.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_forward.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_html.h $(srcinc)/zAVLTree.h
    16601662sh_gpg.o: $(srcsrc)/sh_gpg.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_tiger.h $(srcinc)/sh_static.h
     
    16731675encode.o: $(srcsrc)/encode.c Makefile
    16741676sstrip.o: $(srcsrc)/sstrip.c Makefile config.h
    1675 trustfile.o: $(srcsrc)/trustfile.c Makefile config_xor.h $(srcinc)/sh_calls.h $(srcinc)/slib.h $(srcinc)/sh_static.h
     1677trustfile.o: $(srcsrc)/trustfile.c Makefile config_xor.h $(srcinc)/sh_calls.h $(srcinc)/slib.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h
    16761678exepack.o: $(srcsrc)/exepack.c Makefile config.h $(srcinc)/minilzo.h $(srcinc)/exepack.data
    16771679exepack_fill.o: $(srcsrc)/exepack_fill.c Makefile config.h config.h $(srcinc)/minilzo.h
     
    16861688yulectl.o: $(srcsrc)/yulectl.c Makefile config_xor.h
    16871689sh_mounts.o: $(srcsrc)/sh_mounts.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_modules.h $(srcinc)/sh_mounts.h
    1688 sh_userfiles.o: $(srcsrc)/sh_userfiles.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_modules.h $(srcinc)/sh_userfiles.h $(srcinc)/sh_utils.h $(srcinc)/sh_schedule.h $(srcinc)/sh_error.h $(srcinc)/sh_hash.h $(srcinc)/sh_files.h $(srcinc)/sh_static.h
    1689 sh_prelude.o: $(srcsrc)/sh_prelude.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_cat.h $(srcinc)/sh_error_min.h $(srcinc)/sh_prelude.h
     1690sh_userfiles.o: $(srcsrc)/sh_userfiles.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_modules.h $(srcinc)/sh_userfiles.h $(srcinc)/sh_utils.h $(srcinc)/sh_schedule.h $(srcinc)/sh_error.h $(srcinc)/sh_hash.h $(srcinc)/sh_files.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h
     1691sh_prelude.o: $(srcsrc)/sh_prelude.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_cat.h $(srcinc)/sh_error_min.h $(srcinc)/sh_prelude.h $(srcinc)/sh_static.h
    16901692kern_head.o: $(srcsrc)/kern_head.c Makefile config.h $(srcinc)/kern_head.h $(srcinc)/kern_head.h
    16911693sh_prelink.o: $(srcsrc)/sh_prelink.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_tiger.h $(srcinc)/sh_extern.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h
    1692 sh_static.o: $(srcsrc)/sh_static.c Makefile config_xor.h
    1693 sh_prelude_old.o: $(srcsrc)/sh_prelude_old.c Makefile config_xor.h $(srcinc)/slib.h $(srcinc)/sh_mem.h $(srcinc)/sh_cat.h $(srcinc)/sh_error_min.h $(srcinc)/sh_prelude.h $(srcinc)/sh_static.h
     1694sh_static.o: $(srcsrc)/sh_static.c Makefile config_xor.h $(srcinc)/sh_pthread.h
     1695sh_prelude_old.o: $(srcsrc)/sh_prelude_old.c Makefile config_xor.h $(srcinc)/slib.h $(srcinc)/sh_mem.h $(srcinc)/sh_cat.h $(srcinc)/sh_error_min.h $(srcinc)/sh_prelude.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h
    16941696sh_async.o: $(srcsrc)/sh_async.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_calls.h $(srcinc)/sh_error.h
    16951697sh_processcheck.o: $(srcsrc)/sh_processcheck.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_modules.h $(srcinc)/sh_processcheck.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_extern.h $(srcinc)/sh_calls.h $(srcinc)/CuTest.h
    1696 sh_portcheck.o: $(srcsrc)/sh_portcheck.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_mem.h $(srcinc)/sh_calls.h $(srcinc)/sh_utils.h $(srcinc)/sh_modules.h $(srcinc)/CuTest.h
     1698sh_portcheck.o: $(srcsrc)/sh_portcheck.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_mem.h $(srcinc)/sh_calls.h $(srcinc)/sh_utils.h $(srcinc)/sh_modules.h $(srcinc)/sh_pthread.h $(srcinc)/CuTest.h
     1699sh_pthread.o: $(srcsrc)/sh_pthread.c Makefile config_xor.h $(srcinc)/sh_pthread.h
  • trunk/aclocal.m4

    r129 r138  
    17011701                ;;
    17021702
     1703                -pthread)
     1704                AC_MSG_CHECKING([whether pthreads work with $flag])
     1705                PTHREAD_CFLAGS="$flag"
     1706                PTHREAD_LDFLAGS="$flag"
     1707                ;;
     1708
    17031709                -*)
    17041710                AC_MSG_CHECKING([whether pthreads work with $flag])
     
    17211727        save_LIBS="$LIBS"
    17221728        save_CFLAGS="$CFLAGS"
     1729        save_LDFLAGS="$LDFLAGS"
    17231730        LIBS="$PTHREAD_LIBS $LIBS"
    17241731        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
     1732        LDFLAGS="$LDFLAGS $PTHREAD_LDFLAGS"
    17251733
    17261734        # Check for various functions.  We must include pthread.h,
     
    17401748
    17411749        LIBS="$save_LIBS"
     1750        LDFLAGS="$save_LDFLAGS"
    17421751        CFLAGS="$save_CFLAGS"
    17431752
     
    17491758        PTHREAD_LIBS=""
    17501759        PTHREAD_CFLAGS=""
     1760        PTHREAD_LDFLAGS=""
    17511761done
    17521762fi
     
    17991809AC_SUBST(PTHREAD_LIBS)
    18001810AC_SUBST(PTHREAD_CFLAGS)
     1811AC_SUBST(PTHREAD_LDFLAGS)
    18011812AC_SUBST(PTHREAD_CC)
    18021813
  • trunk/configure.ac

    r132 r138  
    800800)
    801801
    802 if test x"${mytclient}" = x-DSH_STANDALONE -o x"${mytclient}" = x-DSH_WITH_CLIENT;
    803 then
    804         ACX_PTHREAD
    805         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    806         LIBS="$PTHREAD_LIBS $LIBS"
    807         CC="$PTHREAD_CC"
    808 fi
    809        
    810802AC_SUBST(setpwd_prg)
    811803AC_SUBST(yulectl_prg)
     
    878870)
    879871
     872if test x"${mytclient}" = x-DSH_STANDALONE -o x"${mytclient}" = x-DSH_WITH_CLIENT;
     873then
     874        ACX_PTHREAD
     875        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
     876        LIBS="$PTHREAD_LIBS $LIBS"
     877        LDFLAGS="$PTHREAD_LDFLAGS $LDFLAGS"
     878        CC="$PTHREAD_CC"
     879fi
     880       
    880881#
    881882# this is from the snort configure.in
  • trunk/depend.dep

    r111 r138  
    11
    22# DO NOT DELETE THIS LINE
    3 samhain.o: $(srcsrc)/samhain.c Makefile config_xor.h $(srcinc)/samhain.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_mail.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 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_tiger.h $(srcinc)/sh_prelink.h $(srcinc)/sh_static.h $(srcinc)/sh_prelude.h $(srcinc)/sh_ignore.h
    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
     3samhain.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_mail.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
     4sh_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_tiger.h $(srcinc)/sh_prelink.h $(srcinc)/sh_pthread.h $(srcinc)/sh_static.h $(srcinc)/sh_prelude.h $(srcinc)/sh_ignore.h
     5sh_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
    66sh_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_mail.h $(srcinc)/sh_forward.h $(srcinc)/sh_prelude.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_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
     7sh_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
    88sh_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.h
    99sh_readconf.o: $(srcsrc)/sh_readconf.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_database.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_files.h $(srcinc)/sh_mail.h $(srcinc)/sh_calls.h $(srcinc)/sh_tiger.h $(srcinc)/sh_forward.h $(srcinc)/sh_modules.h $(srcinc)/sh_gpg.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_prelink.h $(srcinc)/sh_extern.h $(srcinc)/sh_database.h $(srcinc)/sh_prelude.h
    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
     10sh_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
    1111sh_tiger1.o: $(srcsrc)/sh_tiger1.c Makefile config_xor.h
    1212sh_tiger2.o: $(srcsrc)/sh_tiger2.c Makefile config_xor.h
     
    1414sh_tiger2_64.o: $(srcsrc)/sh_tiger2_64.c Makefile config_xor.h
    1515sh_hash.o: $(srcsrc)/sh_hash.c Makefile config_xor.h $(srcinc)/sh_hash.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_tiger.h $(srcinc)/sh_gpg.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_ignore.h $(srcinc)/sh_forward.h $(srcinc)/sh_hash.h
    16 sh_mail.o: $(srcsrc)/sh_mail.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_mail.h $(srcinc)/sh_utils.h $(srcinc)/sh_fifo.h $(srcinc)/sh_tools.h $(srcinc)/sh_static.h $(srcinc)/sh_tools.h
    17 sh_mem.o: $(srcsrc)/sh_mem.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h
    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_static.h
     16sh_mail.o: $(srcsrc)/sh_mail.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_mail.h $(srcinc)/sh_utils.h $(srcinc)/sh_fifo.h $(srcinc)/sh_tools.h $(srcinc)/sh_pthread.h $(srcinc)/sh_static.h $(srcinc)/sh_tools.h
     17sh_mem.o: $(srcsrc)/sh_mem.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_pthread.h
     18sh_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
    1919sh_forward.o: $(srcsrc)/sh_forward.c Makefile config_xor.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_mail.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
    2020sh_modules.o: $(srcsrc)/sh_modules.c Makefile config_xor.h $(srcinc)/sh_modules.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
    2121sh_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
    22 sh_kern.o: $(srcsrc)/sh_kern.c Makefile config_xor.h $(srcinc)/samhain.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
    23 sh_suidchk.o: $(srcsrc)/sh_suidchk.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_modules.h $(srcinc)/sh_suidchk.h $(srcinc)/sh_hash.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_schedule.h $(srcinc)/sh_calls.h
     22sh_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
     23sh_suidchk.o: $(srcsrc)/sh_suidchk.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_suidchk.h $(srcinc)/sh_hash.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_schedule.h $(srcinc)/sh_calls.h
    2424sh_srp.o: $(srcsrc)/sh_srp.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_tiger.h $(srcinc)/sh_mem.h $(srcinc)/sh_utils.h $(srcinc)/sh_srp.h $(srcinc)/bignum.h
    2525sh_fifo.o: $(srcsrc)/sh_fifo.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_unix.h
    26 sh_tools.o: $(srcsrc)/sh_tools.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error.h $(srcinc)/sh_tools.h $(srcinc)/sh_utils.h $(srcinc)/sh_tiger.h $(srcinc)/sh_static.h $(srcinc)/rijndael-api-fst.h $(srcinc)/rijndael-api-fst.h
     26sh_tools.o: $(srcsrc)/sh_tools.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error.h $(srcinc)/sh_tools.h $(srcinc)/sh_utils.h $(srcinc)/sh_tiger.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h $(srcinc)/rijndael-api-fst.h $(srcinc)/rijndael-api-fst.h
    2727sh_html.o: $(srcsrc)/sh_html.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_forward.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_html.h $(srcinc)/zAVLTree.h
    2828sh_gpg.o: $(srcsrc)/sh_gpg.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_tiger.h $(srcinc)/sh_static.h
     
    4141encode.o: $(srcsrc)/encode.c Makefile
    4242sstrip.o: $(srcsrc)/sstrip.c Makefile config.h
    43 trustfile.o: $(srcsrc)/trustfile.c Makefile config_xor.h $(srcinc)/sh_calls.h $(srcinc)/slib.h $(srcinc)/sh_static.h
     43trustfile.o: $(srcsrc)/trustfile.c Makefile config_xor.h $(srcinc)/sh_calls.h $(srcinc)/slib.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h
    4444exepack.o: $(srcsrc)/exepack.c Makefile config.h $(srcinc)/minilzo.h $(srcinc)/exepack.data
    4545exepack_fill.o: $(srcsrc)/exepack_fill.c Makefile config.h config.h $(srcinc)/minilzo.h
     
    5454yulectl.o: $(srcsrc)/yulectl.c Makefile config_xor.h
    5555sh_mounts.o: $(srcsrc)/sh_mounts.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_modules.h $(srcinc)/sh_mounts.h
    56 sh_userfiles.o: $(srcsrc)/sh_userfiles.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_modules.h $(srcinc)/sh_userfiles.h $(srcinc)/sh_utils.h $(srcinc)/sh_schedule.h $(srcinc)/sh_error.h $(srcinc)/sh_hash.h $(srcinc)/sh_files.h $(srcinc)/sh_static.h
    57 sh_prelude.o: $(srcsrc)/sh_prelude.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_cat.h $(srcinc)/sh_error_min.h $(srcinc)/sh_prelude.h
     56sh_userfiles.o: $(srcsrc)/sh_userfiles.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_modules.h $(srcinc)/sh_userfiles.h $(srcinc)/sh_utils.h $(srcinc)/sh_schedule.h $(srcinc)/sh_error.h $(srcinc)/sh_hash.h $(srcinc)/sh_files.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h
     57sh_prelude.o: $(srcsrc)/sh_prelude.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_cat.h $(srcinc)/sh_error_min.h $(srcinc)/sh_prelude.h $(srcinc)/sh_static.h
    5858sh_prelink.o: $(srcsrc)/sh_prelink.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_tiger.h $(srcinc)/sh_extern.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h
    59 sh_static.o: $(srcsrc)/sh_static.c Makefile config_xor.h
    60 sh_prelude_old.o: $(srcsrc)/sh_prelude_old.c Makefile config_xor.h $(srcinc)/slib.h $(srcinc)/sh_mem.h $(srcinc)/sh_cat.h $(srcinc)/sh_error_min.h $(srcinc)/sh_prelude.h $(srcinc)/sh_static.h
     59sh_static.o: $(srcsrc)/sh_static.c Makefile config_xor.h $(srcinc)/sh_pthread.h
     60sh_prelude_old.o: $(srcsrc)/sh_prelude_old.c Makefile config_xor.h $(srcinc)/slib.h $(srcinc)/sh_mem.h $(srcinc)/sh_cat.h $(srcinc)/sh_error_min.h $(srcinc)/sh_prelude.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h
    6161kern_head.o: $(srcsrc)/kern_head.c Makefile config.h $(srcinc)/kern_head.h $(srcinc)/kern_head.h
    6262sh_async.o: $(srcsrc)/sh_async.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_calls.h $(srcinc)/sh_error.h
    6363sh_processcheck.o: $(srcsrc)/sh_processcheck.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_modules.h $(srcinc)/sh_processcheck.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_extern.h $(srcinc)/sh_calls.h $(srcinc)/CuTest.h
    64 sh_portcheck.o: $(srcsrc)/sh_portcheck.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_mem.h $(srcinc)/sh_calls.h $(srcinc)/sh_utils.h $(srcinc)/sh_modules.h $(srcinc)/CuTest.h
     64sh_portcheck.o: $(srcsrc)/sh_portcheck.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_mem.h $(srcinc)/sh_calls.h $(srcinc)/sh_utils.h $(srcinc)/sh_modules.h $(srcinc)/sh_pthread.h $(srcinc)/CuTest.h
     65sh_pthread.o: $(srcsrc)/sh_pthread.c Makefile config_xor.h $(srcinc)/sh_pthread.h
  • trunk/depend.sum

    r111 r138  
    1 1096789008
     1754800869
  • trunk/docs/Changelog

    r135 r138  
    55        * protect readdir(), getpwent(), gethostname() with mutexes
    66          (readdir_r considered harmful)
    7         * make checksum/hash, entropy function reentrant
     7        * make checksum/hash, entropy, rng functions reentrant
    88        * use thread-specific conversion buffer for globber()
     9        * fixed compile problems and problems with test suite
    910
    10112.3.8:
  • trunk/include/samhain.h

    r133 r138  
    4343#define SH_PATHBUF      256
    4444
    45 #define SH_GRBUF_SIZE  4096
    46 #define SH_PWBUF_SIZE  4096
    4745#define SH_ERRBUF_SIZE   64
    4846
  • trunk/include/sh_files.h

    r131 r138  
    3030void kill_sh_dirlist (struct sh_dirent * dirlist);
    3131
     32#ifdef NEED_ADD_DIRENT
    3233/* add an entry to a directory listing
    3334 */
    3435struct sh_dirent * addto_sh_dirlist (struct dirent * thisEntry,
    3536                                     struct sh_dirent * dirlist);
     37#endif
     38
    3639/* register exceptions to hardlink check
    3740 */
  • trunk/include/sh_pthread.h

    r134 r138  
    55
    66#include <pthread.h>
     7
    78#define SH_MUTEX(M)                             pthread_mutex_t M
    89#define SH_MUTEX_INIT(M,I)                      pthread_mutex_t M = I
     
    1011#define SH_MUTEX_EXTERN(M)                      extern pthread_mutex_t M
    1112
     13/* pthread_mutex_unlock() has the wrong type (returns int), so
     14 * we need to wrap it in this function.
     15 */
     16extern void sh_pthread_mutex_unlock (void *arg);
     17
    1218#define SH_MUTEX_LOCK(M)                                                   \
    1319        do {                                                               \
    1420                int oldtype;                                               \
    1521                pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);  \
    16                 pthread_cleanup_push(pthread_mutex_unlock, (void *) &(M)); \
     22                pthread_cleanup_push(sh_pthread_mutex_unlock, (void*)&(M));\
    1723                pthread_mutex_lock(&(M))
    1824
    1925
    20 #define SH_MUTEX_UNLOCK(M,C)                                               \
     26#define SH_MUTEX_UNLOCK(M)                                                 \
    2127                pthread_cleanup_pop(1);                                    \
    2228                pthread_setcanceltype(oldtype, NULL);                      \
     
    2632#define SH_MUTEX_UNLOCK_UNSAFE(M) pthread_mutex_unlock(&(M))
    2733
     34
     35/*
     36 * ----   Recursive mutex  ----
     37 */
     38#if defined(PTHREAD_MUTEX_RECURSIVE)
     39
     40/* On GNU C, it's an enum, thus the alternative implementation
     41 * below is used.
     42 */
     43#define SH_MUTEX_RECURSIVE(M)                                          \
     44static pthread_mutex_t M;                                              \
     45static void M ## _init (void)                                          \
     46{                                                                      \
     47  pthread_mutexattr_t   mta;                                           \
     48  pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE);            \
     49  pthread_mutex_init(&(M), &mta);                                      \
     50  pthread_mutexattr_destroy(&mta);                                     \
     51  return;                                                              \
     52}                                                                      \
     53static pthread_once_t  M ## _initialized = PTHREAD_ONCE_INIT
     54
     55#define SH_MUTEX_RECURSIVE_INIT(M)                                     \
     56(void) pthread_once(&(M ## _initialized), (M ## _init))
     57
     58#define SH_MUTEX_RECURSIVE_LOCK(M)                                         \
     59        do {                                                               \
     60                int oldtype;                                               \
     61                pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);  \
     62                pthread_cleanup_push(sh_pthread_mutex_unlock, (void*)&(M));\
     63                pthread_mutex_lock(&(M))
     64
     65#define SH_MUTEX_RECURSIVE_UNLOCK(M)                                       \
     66                pthread_cleanup_pop(1);                                    \
     67                pthread_setcanceltype(oldtype, NULL);                      \
     68        } while (0)
     69
     70#else
     71/* !defined(PTHREAD_MUTEX_RECURSIVE) */
     72 struct sh_RMutex {
     73
     74  pthread_mutex_t lock;
     75  unsigned int    held;
     76  unsigned int    waiters;
     77  pthread_t       tid;
     78  pthread_cond_t  cv;
     79};
     80
     81void sh_RMutexLock(struct sh_RMutex * tok);
     82void sh_RMutexUnlock(void * arg);
     83void sh_InitRMutex(struct sh_RMutex * tok);
     84
     85#define SH_MUTEX_RECURSIVE(M)                                          \
     86static struct sh_RMutex M;                                             \
     87static void M ## _init (void)                                          \
     88{                                                                      \
     89  sh_InitRMutex(&(M));                                                 \
     90  return;                                                              \
     91}                                                                      \
     92static pthread_once_t  M ## _initialized = PTHREAD_ONCE_INIT
     93
     94#define SH_MUTEX_RECURSIVE_INIT(M)                                     \
     95(void) pthread_once(&(M ## _initialized), (M ## _init))
     96
     97#define SH_MUTEX_RECURSIVE_LOCK(M)                                         \
     98        do {                                                               \
     99                int oldtype;                                               \
     100                pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);  \
     101                pthread_cleanup_push(sh_RMutexUnlock, (void*)&(M));        \
     102                sh_RMutexLock(&(M))
     103
     104#define SH_MUTEX_RECURSIVE_UNLOCK(M)                                       \
     105                pthread_cleanup_pop(1);                                    \
     106                pthread_setcanceltype(oldtype, NULL);                      \
     107        } while (0)
     108
     109#endif
    28110/*
    29111 * ----   Global mutexes   ----
     
    32114SH_MUTEX_EXTERN(mutex_resolv);
    33115SH_MUTEX_EXTERN(mutex_pwent);
     116SH_MUTEX_EXTERN(mutex_readdir);
    34117
    35118/*
     
    49132#define SH_MUTEX_UNLOCK_UNSAFE(M)               ((void)0)
    50133
     134#define SH_MUTEX_RECURSIVE(M)                   extern void *SH_MUTEX_DUMMY_ ## M
     135#define SH_MUTEX_RECURSIVE_INIT(M)              ((void)0)
     136#define SH_MUTEX_RECURSIVE_LOCK(M)              ((void)0)
     137#define SH_MUTEX_RECURSIVE_UNLOCK(M)            ((void)0)
     138
    51139/* #ifdef HAVE_PTHREAD */
    52140#endif
  • trunk/include/sh_tiger.h

    r133 r138  
    99typedef long int TigerType;
    1010
    11 #define TIGER_FILE -1;
    12 #define TIGER_DATA -2;
     11#define TIGER_FILE -1
     12#define TIGER_DATA -2
    1313
    1414/****************
     15typedef long int TigerType;
    1516typedef enum {
    1617  TIGER_FILE,
     
    2425/* the checksum function
    2526 */
    26 /*@owned@*/ char * sh_tiger_hash (const char * filename, TigerType what,
    27                                   UINT64 Length, char * out, size_t len);
     27char * sh_tiger_hash (const char * filename, TigerType what,
     28                      UINT64 Length, char * out, size_t len);
    2829
    2930/* NEW Thu Oct 18 19:59:08 CEST 2001
  • trunk/include/sh_utils.h

    r132 r138  
    5858 *  generator.
    5959 */
    60 UINT32 taus_get            (void *state1, void *state2, void *state3); 
     60UINT32 taus_get            (); 
    6161double taus_get_double     (void *vstate);  /* fast */
    6262int    taus_seed           (void);
     
    8585 */
    8686char * sh_util_siggen (char * hexkey, 
    87                        char * text, size_t textlen);
     87                       char * text, size_t textlen,
     88                       char * sigbuf, size_t sigbuflen);
    8889
    8990/* eval boolean input
     
    112113int sh_util_obscure_ok (const char * str);
    113114
    114 /* output a hexchar[2]
     115/* output a hexchar[2]; i2h must be char[2]
    115116 */
    116 char * sh_util_charhex( unsigned char c );
     117char * sh_util_charhex( unsigned char c, char * i2h );
    117118
    118119/* read a hexchar, return int value (0-15)
  • trunk/include/slib.h

    r131 r138  
    6060#define SL_FALSE 0
    6161
     62#define SH_GRBUF_SIZE  4096
     63#define SH_PWBUF_SIZE  4096
    6264
    6365
  • trunk/src/sh_entropy.c

    r135 r138  
    333333
    334334#ifdef NAME_OF_DEV_URANDOM
    335   m_count = read_mbytes (30, NAME_OF_DEV_RANDOM, nbuf, nbytes);
     335  m_count = read_mbytes (  1, NAME_OF_DEV_RANDOM, nbuf, nbytes);
    336336#else
    337337  m_count = read_mbytes (300, NAME_OF_DEV_RANDOM, nbuf, nbytes);
  • trunk/src/sh_err_log.c

    r137 r138  
    947947      log_msg.timestamp[0] = '\0';
    948948      (void) sl_strlcpy (sigkey_new,
    949                          sh_tiger_hash (sigkey_old, TIGER_DATA, KEY_LEN, hashbuf, sizeof(hashbuf)),
     949                         sh_tiger_hash (sigkey_old, TIGER_DATA, KEY_LEN,
     950                                        hashbuf, sizeof(hashbuf)),
    950951                         KEY_LEN+1);
    951952    }
     
    953954  /* --- Sign the message with the signature key. ---
    954955   */
    955   sh_tiger_hash (log_msg.msg, -1, 10, hashbuf, 10);
    956956  sh_tiger_hash (log_msg.msg, TIGER_DATA,
    957                  (unsigned long)(status + KEY_LEN), (char *) hashbuf, (size_t) sizeof(hashbuf));
     957                 (unsigned long)(status + KEY_LEN),
     958                 (char *) hashbuf, (size_t) sizeof(hashbuf));
    958959
    959960  (void) sl_strlcat (log_msg.msg, sigkey_new, (size_t)(status + KEY_LEN + 2));
    960961  (void) sl_strlcpy (log_msg.signature,
    961962                     sh_tiger_hash (log_msg.msg, (TigerType) TIGER_DATA,
    962                                     (unsigned long)(status + KEY_LEN), hashbuf, sizeof(hashbuf)),
     963                                    (unsigned long)(status + KEY_LEN),
     964                                    hashbuf, sizeof(hashbuf)),
    963965                     KEY_LEN+1);
    964966  (void) sl_strlcpy (sigkey_old, sigkey_new, KEY_LEN+1);
  • trunk/src/sh_mem.c

    r137 r138  
    2020#include "config_xor.h"
    2121
    22 /* With glibc, _XOPEN_SOURCE 500 is required for
    23  * pthread_mutexattr_settype/PTHREAD_MUTEX_RECURSIVE
    24  */
    25 #if defined(HAVE_PTHREAD) && defined(MEM_DEBUG)
    26 #define _XOPEN_SOURCE 500
    27 #endif
    28 
    2922#include <stdio.h>
    3023#include <stdlib.h>
     
    111104
    112105#ifdef HAVE_PTHREAD
    113 static pthread_once_t mem_is_initialized = PTHREAD_ONCE_INIT;
    114 static pthread_mutex_t mutex_mem;
    115 
    116 static void initialize_mem(void)
    117 {
    118   pthread_mutexattr_t   mta;
    119   pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE);
    120   pthread_mutex_init(&mutex_mem, &mta);
    121   pthread_mutexattr_destroy(&mta);
    122   return;
    123 }
    124 #define MEM_MUTEX_INIT  (void) pthread_once(&mem_is_initialized, initialize_mem)
     106
     107SH_MUTEX_RECURSIVE(mutex_mem);
     108
    125109#else
    126110#define MEM_MUTEX_INIT ((void)0)
     
    135119  FILE * fd;
    136120
    137   MEM_MUTEX_INIT;
    138   SH_MUTEX_LOCK(mutex_mem);
     121  SH_MUTEX_RECURSIVE_INIT(mutex_mem);
     122  SH_MUTEX_RECURSIVE_LOCK(mutex_mem);
    139123
    140124  fd = fopen(MEM_LOG, "w");
     
    146130    }
    147131  fclose(fd);
    148   SH_MUTEX_UNLOCK(mutex_mem);
     132  SH_MUTEX_RECURSIVE_UNLOCK(mutex_mem);
    149133  return;
    150134}
     
    163147  SL_ENTER(_("sh_mem_stat"));
    164148
    165   MEM_MUTEX_INIT;
    166   SH_MUTEX_LOCK(mutex_mem);
     149  SH_MUTEX_RECURSIVE_INIT(mutex_mem);
     150  SH_MUTEX_RECURSIVE_LOCK(mutex_mem);
    167151
    168152  if (Alloc_Count == Free_Count)
     
    201185    }
    202186 out:
    203   SH_MUTEX_UNLOCK(mutex_mem);
     187  SH_MUTEX_RECURSIVE_UNLOCK(mutex_mem);
    204188  SL_RET0(_("sh_mem_stat"));
    205189}
     
    212196  SL_ENTER(_("sh_mem_check"));
    213197
    214   MEM_MUTEX_INIT;
    215   SH_MUTEX_LOCK(mutex_mem);
     198  SH_MUTEX_RECURSIVE_INIT(mutex_mem);
     199  SH_MUTEX_RECURSIVE_LOCK(mutex_mem);
    216200  sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_MSTAMP,
    217201                   Mem_Max, Mem_Current);
     
    246230  /* if (nerr > 0) abort(); */
    247231
    248   SH_MUTEX_UNLOCK(mutex_mem);
     232  SH_MUTEX_RECURSIVE_UNLOCK(mutex_mem);
    249233  SL_RET0(_("sh_mem_check"));
    250234}
     
    258242  SL_ENTER(_("sh_mem_malloc"));
    259243
    260   MEM_MUTEX_INIT;
    261   SH_MUTEX_LOCK(mutex_mem);
     244  SH_MUTEX_RECURSIVE_INIT(mutex_mem);
     245  SH_MUTEX_RECURSIVE_LOCK(mutex_mem);
    262246  the_realAddress = malloc(size + 2 * SH_MEMMULT);
    263247 
     
    368352      _exit(42);
    369353    }
    370 
    371   /* make list entry */
    372 
    373   this->real_address = the_realAddress;
    374   this->address      = theAddress;
    375   this->size         = size;
    376   this->line         = line;
    377   sl_strlcpy(this->file, file, 20);
    378 
    379   this->next = memlist;
    380   memlist = this;
    381 
    382   SH_MUTEX_UNLOCK(mutex_mem);
     354  else
     355    {
     356      /* make list entry */
     357
     358      this->real_address = the_realAddress;
     359      this->address      = theAddress;
     360      this->size         = size;
     361      this->line         = line;
     362      sl_strlcpy(this->file, file, 20);
     363
     364      this->next = memlist;
     365      memlist = this;
     366    }
     367
     368  SH_MUTEX_RECURSIVE_UNLOCK(mutex_mem);
    383369  SL_RETURN( theAddress, _("sh_mem_malloc"));
    384370}
     
    393379  SL_ENTER(_("sh_mem_free"));
    394380
    395   MEM_MUTEX_INIT;
    396   SH_MUTEX_LOCK(mutex_mem);
     381  SH_MUTEX_RECURSIVE_INIT(mutex_mem);
     382  SH_MUTEX_RECURSIVE_LOCK(mutex_mem);
    397383  if ( a == NULL )
    398384    {
     
    466452  Mem_Current -= size;
    467453 out:
    468   SH_MUTEX_UNLOCK(mutex_mem);
     454  SH_MUTEX_RECURSIVE_UNLOCK(mutex_mem);
    469455  SL_RET0(_("sh_mem_free"));
    470456}
  • trunk/src/sh_pthread.c

    r136 r138  
    1414  return;
    1515}
     16
     17
     18/**
     19 * libxml2 threads.c: set of generic threading related routines
     20 *
     21 * Gary Pennington <Gary.Pennington@uk.sun.com>
     22 * daniel@veillard.com
     23 */
     24
     25void sh_InitRMutex(struct sh_RMutex * tok)
     26{
     27  pthread_mutex_init(&tok->lock, NULL);
     28  tok->held = 0;
     29  tok->waiters = 0;
     30  pthread_cond_init(&tok->cv, NULL);
     31
     32  return;
     33}
     34
     35void sh_RMutexLock(struct sh_RMutex * tok)
     36{
     37  if (tok == NULL)
     38    return;
     39
     40  pthread_mutex_lock(&tok->lock);
     41  if (tok->held) {
     42    if (pthread_equal(tok->tid, pthread_self())) {
     43      tok->held++;
     44      pthread_mutex_unlock(&tok->lock);
     45      return;
     46    } else {
     47      tok->waiters++;
     48      while (tok->held)
     49        pthread_cond_wait(&tok->cv, &tok->lock);
     50      tok->waiters--;
     51    }
     52  }
     53  tok->tid = pthread_self();
     54  tok->held = 1;
     55  pthread_mutex_unlock(&tok->lock);
     56}
     57
     58void sh_RMutexUnlock(void * arg)
     59{
     60  struct sh_RMutex * tok = (struct sh_RMutex *) arg;
     61
     62  if (tok == NULL)
     63    return;
     64   
     65  pthread_mutex_lock(&tok->lock);
     66  tok->held--;
     67  if (tok->held == 0) {
     68    if (tok->waiters)
     69      pthread_cond_signal(&tok->cv);
     70    tok->tid = 0;
     71  }
     72  pthread_mutex_unlock(&tok->lock);
     73}
    1674#endif
  • trunk/src/sh_srp.c

    r137 r138  
    337337  int    res;
    338338  char   hash[KEY_LEN+1];
     339  char hashbuf[KEYBUF_SIZE];
    339340
    340341  SL_ENTER(_("sh_srp_make_a"));
     
    345346  (void) sl_strlcpy (hash,
    346347                     sh_tiger_hash((char *)&randl[0], TIGER_DATA,
    347                                    (unsigned long) 6*sizeof(UINT32)),
     348                                   (unsigned long) 6*sizeof(UINT32),
     349                                   hashbuf, sizeof(hashbuf)),
    348350                     KEY_LEN+1);
    349351
  • trunk/src/sh_suidchk.c

    r137 r138  
    10101010           
    10111011            status = sh_unix_getinfo (ShDFLevel[SH_ERR_T_RO],
    1012                                       thisEntry->d_name,
     1012                                      dirlist->sh_d_name,
    10131013                                      &theFile, fileHash, 0);
    10141014           
  • trunk/src/sh_unix.c

    r137 r138  
    36113611          SL_RETURN((-1),_("sh_unix_getinfo"));
    36123612        }
    3613    
     3613
    36143614    if (linknamebuf[0] == '/')
    36153615      {
  • trunk/test/testcompile.sh

    r96 r138  
    110110        if test x$1 = x0; then
    111111                [ -z "$verbose" ]     ||  log_msg_ok  "configure...  $TEST";
     112                $MAKE clean > /dev/null 2>> test_log
    112113                $MAKE ${SMATCH} cutest > /dev/null 2>> test_log
    113114                if test x$? = x0; then
  • trunk/test/testrun_1.sh

    r122 r138  
    933933run_check ()
    934934{
    935      ${VALGRIND} ./samhain -t check -p none -l debug 2>>test_log_valgrind
     935    ${VALGRIND} ./samhain -t check -p none -l debug 2>>test_log_valgrind
    936936 
    937937    if test x$? = x0; then
Note: See TracChangeset for help on using the changeset viewer.