Changeset 162


Ignore:
Timestamp:
Feb 1, 2008, 1:03:47 AM (14 years ago)
Author:
katerina
Message:

Fix for ticket #89, #90, and #91 (locking,compile failure).

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.in

    r161 r162  
    16961696sh_async.o: $(srcsrc)/sh_async.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_calls.h $(srcinc)/sh_error.h
    16971697sh_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)/sh_pthread.h $(srcinc)/CuTest.h
    1698 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)/sh_pthread.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_static.h $(srcinc)/sh_pthread.h $(srcinc)/CuTest.h
    16991699sh_pthread.o: $(srcsrc)/sh_pthread.c Makefile config_xor.h $(srcinc)/sh_pthread.h $(srcinc)/sh_calls.h $(srcinc)/sh_modules.h
  • trunk/configure.ac

    r158 r162  
    1313dnl start
    1414dnl
    15 AM_INIT_AUTOMAKE(samhain, 2.4.2)
     15AM_INIT_AUTOMAKE(samhain, 2.4.3)
    1616AC_CANONICAL_HOST
    1717
     
    207207        sys/select.h sys/socket.h netinet/in.h \
    208208        regex.h glob.h \
    209         linux/ext2_fs.h linux/fs.h ext2fs/ext2_fs.h \
     209        linux/ext2_fs.h linux/fs.h ext2fs/ext2_fs.h asm/segment.h \
    210210        elf.h linux/elf.h \
    211211        paths.h arpa/nameser.h arpa/nameser_compat.h \
     
    17511751           if test x"$kernel_version" = xLINUX26
    17521752           then
    1753 
     1753                AC_MSG_CHECKING([for modlist_lock])
    17541754                sh_modlist_lock=`egrep ['[bd] modlist_lock$'] ${khidemap} | awk '{print $1}'`
    17551755                if test x"$sh_modlist_lock" = x; then
    1756                         echo "--enable-khide: symbol modlist_lock not found in ${khidemap}"
     1756                        AC_MSG_RESULT(no)
    17571757                else
    17581758                        sh_modlist_lock="0x${sh_modlist_lock}"
     1759                        AC_MSG_RESULT([${sh_modlist_lock}])
    17591760                        AC_DEFINE_UNQUOTED(SH_MODLIST_LOCK, ${sh_modlist_lock}, [The address of the modules list spinlock])
    17601761                fi
    1761                                    
     1762
     1763                AC_MSG_CHECKING([for module_mutex])                 
    17621764                sh_modlist_mutex=`egrep ['[bd] module_mutex$'] ${khidemap} | awk '{print $1}'`
    17631765                if test x"$sh_modlist_mutex" = x; then
    1764                         echo "--enable-khide: symbol module_mutex not found in ${khidemap}"
     1766                        AC_MSG_RESULT(no)
    17651767                else
    17661768                        sh_modlist_mutex="0x${sh_modlist_mutex}"
     1769                        AC_MSG_RESULT([${sh_modlist_mutex}])
    17671770                        AC_DEFINE_UNQUOTED(SH_MODLIST_MUTEX, ${sh_modlist_mutex}, [The address of the modules list mutex])
    17681771                fi
     
    17921795                AC_MSG_WARN([--enable-khide: headers for the currently-running kernel.])
    17931796           fi
     1797
     1798           AC_MSG_CHECKING([for 2.4 vanilla kernel])
    17941799           sh_is_vanilla_kernel=yes
    17951800           if test -f /lib/modules/${kvers}/build/include/linux/sched.h; then
     
    17971802           fi
    17981803           if test x"${sh_is_vanilla_kernel}" = xno; then
    1799                 echo "This is not a 2.4 vanilla kernel"
     1804                AC_MSG_RESULT(no)
    18001805           else
     1806                AC_MSG_RESULT(yes)
    18011807                AC_DEFINE(SH_VANILLA_KERNEL)
    18021808           fi
     1809
    18031810        fi
    18041811        ]
  • trunk/depend.dep

    r149 r162  
    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
    5959sh_static.o: $(srcsrc)/sh_static.c Makefile config_xor.h $(srcinc)/sh_pthread.h
    60 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)/sh_pthread.h $(srcinc)/CuTest.h
     60sh_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_static.h $(srcinc)/sh_pthread.h $(srcinc)/CuTest.h
    6161sh_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)/sh_pthread.h $(srcinc)/CuTest.h
    6262sh_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
  • trunk/depend.sum

    r149 r162  
    1 1156805991
     12613935365
  • trunk/docs/Changelog

    r161 r162  
    112.4.3:
     2        * sh_kern.c: don't require asm/segment.h for kernel check module
     3        * use global var with pid of initial thread instead of getpid(),
     4          since LinuxThreads returns different value in each thread (problem
     5          reported by Steffen Mueller)
     6        * sh_kern.c: no inode check for pci rom (creates spurious messages)
     7        * slib.c: eliminate prototype for vsnprintf (compile problem reported
     8          by eddy_cs)
    29        * Makefile.in: fix missing dependency on 'encode' for $(OBJECTS)
    310          (reported by Matthias Ehrmann)
    411
    5 2.4.2:
     122.4.2 (17-01-2008):
    613        * fix broken option --with-checksum (reported by halosfan),
    714          regression test added
  • trunk/include/samhain.h

    r156 r162  
    249249
    250250  char   prg_name[8];
     251
     252  UINT64 pid; 
    251253 
    252254  sh_sh_df     exec;
  • trunk/src/samhain.c

    r160 r162  
    362362  sh.prg_name[7] = '\0';
    363363#endif
     364
     365  sh.pid = (UINT64) getpid();
    364366
    365367  /* The flags.
  • trunk/src/sh_hash.c

    r160 r162  
    12061206          {
    12071207            dlog(1, FIL__, __LINE__,
    1208                  _("The checksum of the file signature database has changed since startup.\n"));
     1208                 _("The checksum of the file signature database has changed since startup: %s -> %s\n"),
     1209                 sh.data.hash, sh_tiger_hash (file_path('D', 'R'), fd, TIGER_NOLIM,
     1210                                           hashbuf, sizeof(hashbuf)));
    12091211            sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_E_AUTH,
    12101212                             ( (NULL == file_path('D', 'R')) ? _("(null)") :
  • trunk/src/sh_kern.c

    r146 r162  
    266266 * Interrupt Descriptor Table
    267267 */
    268 
     268#ifdef HAVE_ASM_SEGMENT_H
    269269#include <asm/segment.h>
     270#endif
    270271
    271272#define SH_MAXIDT   256
     
    276277{
    277278  switch (segment) {
     279#ifdef __KERNEL_CS
    278280  case __KERNEL_CS:
    279281    return _("KERNEL_CS");
     282#endif
     283#ifdef __KERNEL_DS
    280284  case __KERNEL_DS:
    281285    return _("KERNEL_DS");
     286#endif
     287#ifdef __USER_CS
    282288  case __USER_CS:
    283289    return _("USER_CS");
     290#endif
     291#ifdef __USER_DS
    284292  case __USER_DS:
    285293    return _("USER_DS");
     294#endif
    286295  default:
    287296    return _("unknown");
     
    903912  (void) sl_strlcpy (theFile.fullpath, pcipath, PATH_MAX);
    904913  theFile.check_mask  = sh_files_maskof(SH_LEVEL_READONLY);
    905   theFile.check_mask &= ~(MODI_MTM|MODI_CTM);
     914  theFile.check_mask &= ~(MODI_MTM|MODI_CTM|MODI_INO);
    906915  CLEAR_SH_FFLAG_REPORTED(theFile.file_reported);
    907916  theFile.attr_string = NULL;
     
    938947  struct stat buf;
    939948  int         fd;
     949  int         status;
    940950
    941951  if (0 == stat(pcipath, &buf))
     
    945955       */
    946956      fd = open ( pcipath, O_RDWR );
    947       write( fd, "1", 1 );
     957      do {
     958        status = write( fd, "1", 1 );
     959      } while (status < 0 && errno == EINTR);
    948960      close ( fd );
    949961
     
    951963
    952964      fd = open ( pcipath, O_RDWR );
    953       write( fd, "0", 1 );
     965      do {
     966        status = write( fd, "0", 1 );
     967      } while (status < 0 && errno == EINTR);
    954968      close ( fd );
    955969    }
  • trunk/src/sh_portcheck.c

    r149 r162  
    129129#include "sh_utils.h"
    130130#include "sh_modules.h"
     131#include "sh_static.h"
    131132#include "sh_pthread.h"
    132133
     
    897898           
    898899  SH_MUTEX_LOCK(mutex_resolv);
    899   hent = gethostbyname(portchk_hostname);
     900  hent = sh_gethostbyname(portchk_hostname);
    900901
    901902  while (hent && hent->h_addr_list[i] && (iface_list.used < SH_IFACE_MAX))
  • trunk/src/sh_unix.c

    r160 r162  
    18661866
    18671867    setsid();            /* should not fail         */
     1868    sh.pid = (UINT64) getpid();
    18681869
    18691870    switch (aud_fork(FIL__, __LINE__)) {
     
    18761877     */
    18771878    sh_unix_memlock();
     1879    sh.pid = (UINT64) getpid();
    18781880
    18791881  } else {
     
    38443846      sl_close(fd);
    38453847
    3846       if (status == (int) getpid())
     3848      if (status > 0 && (unsigned int) status == sh.pid)
    38473849        {
    38483850          if (filename != NULL)
     
    40074009  SL_ENTER(_("sh_unix_lock"));
    40084010
    4009   sprintf (myPid, "%ld\n", (long) getpid());           /* known to fit  */
     4011  sprintf (myPid, "%ld\n", (long) sh.pid);             /* known to fit  */
    40104012
    40114013  fd = sl_open_safe_rdwr (lockfile, SL_YESPRIV);       /* fails if file exists */
  • trunk/src/slib.c

    r144 r162  
    577577}
    578578
    579 #if !defined(HOST_IS_I86SOLARIS)
    580 #if !defined (_GNU_SOURCE) && !defined(__linux__)
    581 /* flawfinder: ignore */
    582 extern int vsnprintf ( char *str, size_t n,
    583                        const char *format, va_list ap );
    584 #endif
    585 #endif
    586579
    587580#if !defined (VA_COPY)
  • trunk/test/testhash.sh

    r159 r162  
    3737        fi
    3838        #
    39         ${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
     39        ${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 
    4040        #
    4141        fail=0
Note: See TracChangeset for help on using the changeset viewer.