Changeset 463


Ignore:
Timestamp:
Feb 17, 2015, 5:43:59 PM (10 years ago)
Author:
katerina
Message:

Fix for ticket #363 (database load on init when missing file in config).

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r460 r463  
    1212dnl start
    1313dnl
    14 AM_INIT_AUTOMAKE(samhain, 3.1.3)
     14AM_INIT_AUTOMAKE(samhain, 3.1.4)
    1515AC_DEFINE([SAMHAIN], 1, [Application is samhain])
    1616AC_CANONICAL_HOST
  • trunk/docs/Changelog

    r462 r463  
    113.1.4:
    2         * fix buffer allocation for getgrnam_r for large groups
     2        * Add non-existent file to the regression test config
     3        * Fix erroneous call to sh_hash_init when a missing file
     4          is specified in the configuration
     5        * Fix buffer allocation for getgrnam_r for large groups
    36          (problem reported by Sergio B)
    4         * search RPM in $HOME/rpmbuild if test -d _topdir fails (CentOS
     7        * Search RPM in $HOME/rpmbuild if test -d _topdir fails (CentOS
    58          recommends '%(echo $HOME)/topdir', reported by E. Taft)
    69
    7103.1.3 (01-11-2014):
    8         * remove initgroups() from the popen call in unix entropy gatherer
     11        * Remove initgroups() from the popen call in unix entropy gatherer
    912        * Add error message for update mode if local baseline cannot be found
    1013
  • trunk/src/sh_hash.c

    r458 r463  
    13251325
    13261326  SL_ENTER(_("sh_hash_init"));
     1327
     1328  if ( sh.flag.checkSum == SH_CHECK_INIT )
     1329    {
     1330      dlog(1, FIL__, __LINE__,
     1331           _("Attempt to load the baseline database during initialisation. This is an internal error, please report it to the developer.\n"));
     1332      SH_ABORT;
     1333      aud_exit (FIL__, __LINE__, EXIT_FAILURE);
     1334    }
    13271335
    13281336  SH_MUTEX_LOCK(mutex_hash);
     
    21572165{
    21582166  sh_file_t * p;
    2159   int retval;
    2160 
    2161   if (IsInit != 1)
    2162     sh_hash_init();
    2163 
    2164   SH_MUTEX_LOCK(mutex_hash);
    2165   p = sh_hash_have_it_int (filename);
    2166   if (p)
    2167     retval = p->fflags;
    2168   else
    2169     retval = -1;
    2170   SH_MUTEX_UNLOCK(mutex_hash);
     2167  int retval = 0;
     2168
     2169  if ( sh.flag.checkSum != SH_CHECK_INIT )
     2170    {
     2171      if (IsInit != 1)
     2172        sh_hash_init();
     2173     
     2174      SH_MUTEX_LOCK(mutex_hash);
     2175      p = sh_hash_have_it_int (filename);
     2176      if (p)
     2177        retval = p->fflags;
     2178      else
     2179        retval = -1;
     2180      SH_MUTEX_UNLOCK(mutex_hash);
     2181    }
    21712182  return retval;
    21722183}
     
    21752186{
    21762187  sh_file_t * p;
    2177   int retval;
    2178 
    2179   if (IsInit != 1)
    2180     sh_hash_init();
    2181 
    2182   SH_MUTEX_LOCK(mutex_hash);
    2183   p = sh_hash_have_it_int (filename);
    2184   if (p)
    2185     {
    2186       p->fflags = flags;
    2187       retval = 0;
    2188     }
    2189   else
    2190     retval = -1;
    2191   SH_MUTEX_UNLOCK(mutex_hash);
     2188  int retval = 0;
     2189
     2190  if ( sh.flag.checkSum != SH_CHECK_INIT )
     2191    {
     2192      if (IsInit != 1)
     2193        sh_hash_init();
     2194     
     2195      SH_MUTEX_LOCK(mutex_hash);
     2196      p = sh_hash_have_it_int (filename);
     2197      if (p)
     2198        {
     2199          p->fflags = flags;
     2200          retval = 0;
     2201        }
     2202      else
     2203        retval = -1;
     2204      SH_MUTEX_UNLOCK(mutex_hash);
     2205    }
    21922206  return retval;
    21932207}
     
    21992213  sh_file_t * p;
    22002214
    2201   if (IsInit != 1)
    2202     sh_hash_init();
    2203 
    2204   SH_MUTEX_LOCK(mutex_hash);
    2205   p = sh_hash_have_it_int (filename);
    2206   if (p)
    2207     {
    2208       p->fflags |= flag_to_set;
    2209     }
    2210   SH_MUTEX_UNLOCK(mutex_hash);
     2215  if ( sh.flag.checkSum != SH_CHECK_INIT )
     2216    {
     2217      if (IsInit != 1)
     2218        sh_hash_init();
     2219     
     2220      SH_MUTEX_LOCK(mutex_hash);
     2221      p = sh_hash_have_it_int (filename);
     2222      if (p)
     2223        {
     2224          p->fflags |= flag_to_set;
     2225        }
     2226      SH_MUTEX_UNLOCK(mutex_hash);
     2227    }
    22112228  return;
    22122229}
     
    22182235  sh_file_t * p;
    22192236
    2220   if (IsInit != 1)
    2221     sh_hash_init();
    2222 
    2223   SH_MUTEX_LOCK(mutex_hash);
    2224   p = sh_hash_have_it_int (filename);
    2225   if (p)
    2226     {
    2227       p->fflags &= ~flag_to_clear;
    2228     }
    2229   SH_MUTEX_UNLOCK(mutex_hash);
     2237  if ( sh.flag.checkSum != SH_CHECK_INIT )
     2238    {
     2239      if (IsInit != 1)
     2240        sh_hash_init();
     2241     
     2242      SH_MUTEX_LOCK(mutex_hash);
     2243      p = sh_hash_have_it_int (filename);
     2244      if (p)
     2245        {
     2246          p->fflags &= ~flag_to_clear;
     2247        }
     2248      SH_MUTEX_UNLOCK(mutex_hash);
     2249    }
    22302250  return;
    22312251}
  • trunk/test/testrc_2.in

    r86 r463  
    4343file = /tmp
    4444file = /etc
     45
     46# hopefully does not exist
     47file=/etc/toodleedoo
    4548
    4649dir=1/usr
  • trunk/test/testrun_2a.sh

    r460 r463  
    254254    ####### EXIT HERE FOR TESTING ######
    255255    #
    256     exit 0
    257256    #
    258257    SERVER_BUILDOPTS_ORIG="${SERVER_BUILDOPTS}"
Note: See TracChangeset for help on using the changeset viewer.