Changeset 144


Ignore:
Timestamp:
Oct 31, 2007, 11:33:13 PM (12 years ago)
Author:
rainer
Message:

Fix some more queer compile problems.

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.in

    r143 r144  
    16801680exepack_mkdata.o: $(srcsrc)/exepack_mkdata.c Makefile config.h $(srcinc)/minilzo.h
    16811681minilzo.o: $(srcsrc)/minilzo.c Makefile $(srcinc)/minilzo.h
    1682 slib.o: $(srcsrc)/slib.c Makefile config_xor.h $(srcinc)/slib.h $(srcinc)/sh_calls.h $(srcinc)/sh_static.h $(srcinc)/sh_mem.h
     1682slib.o: $(srcsrc)/slib.c Makefile config_xor.h $(srcinc)/slib.h $(srcinc)/sh_calls.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h $(srcinc)/sh_mem.h
    16831683rijndael-alg-fst.o: $(srcsrc)/rijndael-alg-fst.c Makefile config_xor.h $(srcinc)/rijndael-alg-fst.h $(srcinc)/rijndael-boxes-fst.h
    16841684rijndael-api-fst.o: $(srcsrc)/rijndael-api-fst.c Makefile config_xor.h $(srcinc)/rijndael-alg-fst.h $(srcinc)/rijndael-api-fst.h
  • trunk/aclocal.m4

    r139 r144  
    17831783        fi
    17841784
     1785        # Solaris lossage: default is obsolete semantics for getpwnam_r,
     1786        # getpwuid_r, getgrgid_r, unless _POSIX_PTHREAD_SEMANTICS is defined
    17851787        AC_MSG_CHECKING([if more special flags are required for pthreads])
    17861788        flag=no
    17871789        case "${host_cpu}-${host_os}" in
    17881790            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
    1789             *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
     1791            *-osf* | *-hpux*) flag="-D_REENTRANT";;
     1792            *solaris*) flag="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
    17901793        esac
    17911794        AC_MSG_RESULT(${flag})
  • trunk/depend.dep

    r143 r144  
    4646exepack_mkdata.o: $(srcsrc)/exepack_mkdata.c Makefile config.h $(srcinc)/minilzo.h
    4747minilzo.o: $(srcsrc)/minilzo.c Makefile $(srcinc)/minilzo.h
    48 slib.o: $(srcsrc)/slib.c Makefile config_xor.h $(srcinc)/slib.h $(srcinc)/sh_calls.h $(srcinc)/sh_static.h $(srcinc)/sh_mem.h
     48slib.o: $(srcsrc)/slib.c Makefile config_xor.h $(srcinc)/slib.h $(srcinc)/sh_calls.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h $(srcinc)/sh_mem.h
    4949rijndael-alg-fst.o: $(srcsrc)/rijndael-alg-fst.c Makefile config_xor.h $(srcinc)/rijndael-alg-fst.h $(srcinc)/rijndael-boxes-fst.h
    5050rijndael-api-fst.o: $(srcsrc)/rijndael-api-fst.c Makefile config_xor.h $(srcinc)/rijndael-alg-fst.h $(srcinc)/rijndael-api-fst.h
  • trunk/depend.sum

    r143 r144  
    1 2519500817
     1786796559
  • trunk/docs/Changelog

    r138 r144  
    88        * use thread-specific conversion buffer for globber()
    99        * fixed compile problems and problems with test suite
    10 
    11 2.3.8:
     10        * modify login watch to run as thread
     11        * modify process check to run as thread
     12
     132.3.8 (03-10-2007):
    1214        * new option PortCheckIgnore = interface:portlist
    1315
  • trunk/src/samhain.c

    r143 r144  
    799799static pid_t * procdirSamhain ()
    800800{
    801   pid_t        * pidlist = malloc(sizeof(pid_t) * 65535);
     801  volatile pid_t        * pidlist = malloc(sizeof(pid_t) * 65535);
     802  pid_t        * dummy;
    802803  struct dirent * d;
    803804  DIR *        dp;
     
    817818  if (0 != stat(SH_INSTALL_PATH, &buf))
    818819    {
    819       free(pidlist);
     820      dummy = pidlist;
     821      free(dummy);
    820822      return NULL;
    821823    }
     
    825827  if (NULL == (dp = opendir("/proc")))
    826828    {
    827       free(pidlist);
     829      dummy = pidlist;
     830      free(dummy);
    828831      return NULL;
    829832    }
     
    11931196  float         st_1, st_2;
    11941197  int           status;
    1195   long          cct = 0; /* main loop iterations */
    1196 
    1197   int           flag_check_1 = 0;
    1198   int           flag_check_2 = 0;
     1198  volatile long          cct = 0; /* main loop iterations */
     1199
     1200  volatile int           flag_check_1 = 0;
     1201  volatile int           flag_check_2 = 0;
    11991202
    12001203  int           check_done   = 0;
    12011204#endif
    12021205
    1203   time_t        told;
     1206  volatile time_t        told;
    12041207  time_t        tcurrent;
    12051208  size_t        tzlen;
  • trunk/src/sh_cat.c

    r113 r144  
    125125
    126126#ifdef SH_USE_PROCESSCHECK
    127   { MSG_PCK_CHECK,   SH_ERR_NOTICE,  RUN,   N_("msg=\"Checking processes in pid interval [%ld,%ld]\"")},
     127  { MSG_PCK_CHECK,   SH_ERR_INFO,    RUN,   N_("msg=\"Checking processes in pid interval [%ld,%ld]\"")},
    128128  { MSG_PCK_OK,      SH_ERR_ALL,     RUN,   N_("msg=\"PID %ld found with tests %s\"")},
    129129  { MSG_PCK_P_HIDDEN,SH_ERR_SEVERE,  EVENT, N_("msg=\"POLICY [Process] Hidden pid: %ld tests: %s\" path=\"%s\" userid=\"%s\"")},
     
    138138
    139139#ifdef SH_USE_MOUNTS
    140   { MSG_MNT_CHECK,   SH_ERR_NOTICE,  RUN,   N_("msg=\"Checking mounts\"")},
     140  { MSG_MNT_CHECK,   SH_ERR_INFO,    RUN,   N_("msg=\"Checking mounts\"")},
    141141  { MSG_MNT_MEMLIST, SH_ERR_ERR,     RUN,   N_("msg=\"Cannot read mount list from memory\"")},
    142142  { MSG_MNT_MNTMISS, SH_ERR_WARN,    EVENT, N_("msg=\"Mount missing\" path=\"%s\"")},
     
    440440
    441441#ifdef SH_USE_PROCESSCHECK
    442   { MSG_PCK_CHECK,   SH_ERR_NOTICE,  RUN,   N_("msg=<Checking processes in pid interval [%ld,%ld]>")},
     442  { MSG_PCK_CHECK,   SH_ERR_INFO,    RUN,   N_("msg=<Checking processes in pid interval [%ld,%ld]>")},
    443443  { MSG_PCK_OK,      SH_ERR_ALL,     RUN,   N_("msg=<PID %ld found with tests %s>")},
    444444  { MSG_PCK_P_HIDDEN,SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY [Process] Hidden pid: %ld tests: %s> path=<%s> userid=<%s>")},
  • trunk/src/sh_error.c

    r142 r144  
    2020#include "config_xor.h"
    2121
    22 /* Required on linux to get the correct strerror_r function. Also
    23  * for recursive mutexes (_XOPEN_SOURCE >= 500).
    24  */
     22/* Required on Linux to get the correct strerror_r function. Also
     23 * for recursive mutexes (_XOPEN_SOURCE >= 500). Gives funny error
     24 * on Solaris 10/gcc ('c99' compiler required - huh? Isn't gcc
     25 * good enough?).
     26 */
     27#if !defined(__sun__) && !defined(__sun)
    2528#define _XOPEN_SOURCE 600
     29#endif
    2630#include <string.h>
    2731#include <stdio.h>     
     
    13181322
    13191323 exit_here:
    1320 
     1324  ; /* label at end of compound statement */
    13211325  SH_MUTEX_RECURSIVE_UNLOCK(mutex_err_handle);
    13221326
  • trunk/src/sh_mem.c

    r143 r144  
    185185    }
    186186 out:
     187  ; /* label at end of compound statement */
    187188  SH_MUTEX_RECURSIVE_UNLOCK(mutex_mem);
    188189  SL_RET0(_("sh_mem_stat"));
     
    444445  Mem_Current -= size;
    445446 out:
     447  ; /* label at end of compound statement */
    446448  SH_MUTEX_RECURSIVE_UNLOCK(mutex_mem);
    447449  SL_RET0(_("sh_mem_free"));
  • trunk/src/sh_processcheck.c

    r143 r144  
    689689  struct stat buf;
    690690  DIR * dir;
     691  int  retval;
    691692#ifdef HAVE_STATVFS
    692   int  retval;
    693693  struct statvfs vfsbuf;
    694694#endif
     
    753753  sl_snprintf (path, sizeof(path), "/proc/%ld", (unsigned long) pid);
    754754
    755   if (0 == retry_lstat (FIL__, __LINE__, path, &buf))
     755  do {
     756    retval = lstat (path, &buf);
     757  } while (retval < 0 && errno == EINTR);
     758
     759  if (0 == retval)
    756760    {
    757761      res |= SH_PR_LSTAT;   res |= SH_PR_ANY; ++have_checks;
     
    782786    {
    783787      res |= SH_PR_CHDIR;   res |= SH_PR_ANY; ++have_checks;
    784       retry_aud_chdir(FIL__, __LINE__, "/");
     788      do {
     789        retval = chdir ("/");
     790      } while (retval < 0 && errno == EINTR);
    785791    }
    786792  ++need_checks;
     
    12151221    return SH_MOD_FAILED;
    12161222#ifdef HAVE_PTHREAD
    1217   if (arg != NULL && arg->initval < 0 && sh.flag.isdaemon == S_TRUE)
     1223  if (arg != NULL && arg->initval < 0 &&
     1224      (sh.flag.isdaemon == S_TRUE || sh.flag.loop == S_TRUE))
    12181225    {
    12191226      if (0 == sh_pthread_create(sh_threaded_module_run, (void *)arg))
     
    13071314  userdef_maxpid     = 0;
    13081315  sh_prochk_maxpid   = 0x8000;
    1309   sh_prochk_minpid   = 0x0000;
     1316  sh_prochk_minpid   = 0x0001;
    13101317  sh_prochk_interval = SH_PROCHK_INTERVAL;
    13111318
  • trunk/src/sh_utmp.c

    r143 r144  
    495495    return SH_MOD_FAILED;
    496496#ifdef HAVE_PTHREAD
    497   if (arg != NULL && arg->initval < 0 && sh.flag.isdaemon == S_TRUE)
     497  if (arg != NULL && arg->initval < 0 &&
     498      (sh.flag.isdaemon == S_TRUE || sh.flag.loop == S_TRUE))
    498499    {
    499500      if (0 == sh_pthread_create(sh_threaded_module_run, (void *)arg))
  • trunk/src/slib.c

    r137 r144  
    5555#define SH_NEED_PWD_GRP 1
    5656#include "sh_static.h"
     57#include "sh_pthread.h"
    5758
    5859#undef  FIL__
     
    15141515static SL_OFILE * ofiles[MAXFD];
    15151516
     1517SH_MUTEX_STATIC(mutex_ticket, PTHREAD_MUTEX_INITIALIZER);
    15161518
    15171519static unsigned int nonce_counter = TOFFSET;
     
    15221524  unsigned int high; /* index */
    15231525  unsigned int low;  /* nonce */
     1526  SL_TICKET    retval = SL_EINTERNAL;
    15241527
    15251528  SL_ENTER(_("sl_create_ticket"));
    15261529
    1527   if (myindex >= MAXFD) 
    1528     SL_IRETURN (SL_EINTERNAL, _("sl_create_ticket"));
     1530  if (myindex >= MAXFD)
     1531    goto out_ticket;
    15291532
    15301533  /* mask out the high bit and check that it is not used
     
    15341537
    15351538  if (high != myindex + TOFFSET)
    1536     SL_IRETURN (SL_EINTERNAL, _("sl_create_ticket"));
     1539    goto out_ticket;
     1540
     1541  SH_MUTEX_LOCK_UNSAFE(mutex_ticket);
    15371542
    15381543  low = nonce_counter & 0xffff;
     
    15411546   */
    15421547  if ((low != nonce_counter++) || low == 0)
    1543     SL_IRETURN (SL_EINTERNAL, _("sl_create_ticket"));
     1548    goto out_ticket;
    15441549 
    15451550  /* Wrap around the nonce counter.
     
    15491554    nonce_counter = TOFFSET;
    15501555
    1551   SL_RETURN ((SL_TICKET) ((high << 16) | low), _("sl_create_ticket"));
     1556  retval = (SL_TICKET) ((high << 16) | low);
     1557
     1558 out_ticket:
     1559  ;
     1560
     1561  SH_MUTEX_UNLOCK_UNSAFE(mutex_ticket);
     1562  SL_RETURN (retval, _("sl_create_ticket"));
    15521563}
    15531564
Note: See TracChangeset for help on using the changeset viewer.