Index: /trunk/configure.ac
===================================================================
--- /trunk/configure.ac	(revision 462)
+++ /trunk/configure.ac	(revision 463)
@@ -12,5 +12,5 @@
 dnl start
 dnl
-AM_INIT_AUTOMAKE(samhain, 3.1.3)
+AM_INIT_AUTOMAKE(samhain, 3.1.4)
 AC_DEFINE([SAMHAIN], 1, [Application is samhain])
 AC_CANONICAL_HOST
Index: /trunk/docs/Changelog
===================================================================
--- /trunk/docs/Changelog	(revision 462)
+++ /trunk/docs/Changelog	(revision 463)
@@ -1,10 +1,13 @@
 3.1.4:
-	* fix buffer allocation for getgrnam_r for large groups
+	* Add non-existent file to the regression test config
+	* Fix erroneous call to sh_hash_init when a missing file
+	  is specified in the configuration
+	* Fix buffer allocation for getgrnam_r for large groups
 	  (problem reported by Sergio B)
-	* search RPM in $HOME/rpmbuild if test -d _topdir fails (CentOS
+	* Search RPM in $HOME/rpmbuild if test -d _topdir fails (CentOS
 	  recommends '%(echo $HOME)/topdir', reported by E. Taft)
 
 3.1.3 (01-11-2014):
-	* remove initgroups() from the popen call in unix entropy gatherer
+	* Remove initgroups() from the popen call in unix entropy gatherer
 	* Add error message for update mode if local baseline cannot be found
 
Index: /trunk/src/sh_hash.c
===================================================================
--- /trunk/src/sh_hash.c	(revision 462)
+++ /trunk/src/sh_hash.c	(revision 463)
@@ -1325,4 +1325,12 @@
 
   SL_ENTER(_("sh_hash_init"));
+
+  if ( sh.flag.checkSum == SH_CHECK_INIT )
+    {
+      dlog(1, FIL__, __LINE__, 
+	   _("Attempt to load the baseline database during initialisation. This is an internal error, please report it to the developer.\n"));
+      SH_ABORT;
+      aud_exit (FIL__, __LINE__, EXIT_FAILURE);
+    }
 
   SH_MUTEX_LOCK(mutex_hash);
@@ -2157,16 +2165,19 @@
 {
   sh_file_t * p;
-  int retval;
-
-  if (IsInit != 1) 
-    sh_hash_init();
-
-  SH_MUTEX_LOCK(mutex_hash);
-  p = sh_hash_have_it_int (filename);
-  if (p)
-    retval = p->fflags;
-  else
-    retval = -1;
-  SH_MUTEX_UNLOCK(mutex_hash);
+  int retval = 0;
+
+  if ( sh.flag.checkSum != SH_CHECK_INIT )
+    {
+      if (IsInit != 1) 
+	sh_hash_init();
+      
+      SH_MUTEX_LOCK(mutex_hash);
+      p = sh_hash_have_it_int (filename);
+      if (p)
+	retval = p->fflags;
+      else
+	retval = -1;
+      SH_MUTEX_UNLOCK(mutex_hash);
+    }
   return retval;
 }
@@ -2175,19 +2186,22 @@
 {
   sh_file_t * p;
-  int retval;
-
-  if (IsInit != 1) 
-    sh_hash_init();
-
-  SH_MUTEX_LOCK(mutex_hash);
-  p = sh_hash_have_it_int (filename);
-  if (p)
-    {
-      p->fflags = flags;
-      retval = 0;
-    }
-  else
-    retval = -1;
-  SH_MUTEX_UNLOCK(mutex_hash);
+  int retval = 0;
+
+  if ( sh.flag.checkSum != SH_CHECK_INIT )
+    {
+      if (IsInit != 1) 
+	sh_hash_init();
+      
+      SH_MUTEX_LOCK(mutex_hash);
+      p = sh_hash_have_it_int (filename);
+      if (p)
+	{
+	  p->fflags = flags;
+	  retval = 0;
+	}
+      else
+	retval = -1;
+      SH_MUTEX_UNLOCK(mutex_hash);
+    }
   return retval;
 }
@@ -2199,14 +2213,17 @@
   sh_file_t * p;
 
-  if (IsInit != 1) 
-    sh_hash_init();
-
-  SH_MUTEX_LOCK(mutex_hash);
-  p = sh_hash_have_it_int (filename);
-  if (p)
-    {
-      p->fflags |= flag_to_set;
-    }
-  SH_MUTEX_UNLOCK(mutex_hash);
+  if ( sh.flag.checkSum != SH_CHECK_INIT )
+    {
+      if (IsInit != 1) 
+	sh_hash_init();
+      
+      SH_MUTEX_LOCK(mutex_hash);
+      p = sh_hash_have_it_int (filename);
+      if (p)
+	{
+	  p->fflags |= flag_to_set;
+	}
+      SH_MUTEX_UNLOCK(mutex_hash);
+    }
   return;
 }
@@ -2218,14 +2235,17 @@
   sh_file_t * p;
 
-  if (IsInit != 1) 
-    sh_hash_init();
-
-  SH_MUTEX_LOCK(mutex_hash);
-  p = sh_hash_have_it_int (filename);
-  if (p)
-    {
-      p->fflags &= ~flag_to_clear;
-    }
-  SH_MUTEX_UNLOCK(mutex_hash);
+  if ( sh.flag.checkSum != SH_CHECK_INIT )
+    {
+      if (IsInit != 1) 
+	sh_hash_init();
+      
+      SH_MUTEX_LOCK(mutex_hash);
+      p = sh_hash_have_it_int (filename);
+      if (p)
+	{
+	  p->fflags &= ~flag_to_clear;
+	}
+      SH_MUTEX_UNLOCK(mutex_hash);
+    }
   return;
 }
Index: /trunk/test/testrc_2.in
===================================================================
--- /trunk/test/testrc_2.in	(revision 462)
+++ /trunk/test/testrc_2.in	(revision 463)
@@ -43,4 +43,7 @@
 file = /tmp
 file = /etc
+
+# hopefully does not exist
+file=/etc/toodleedoo
 
 dir=1/usr
Index: /trunk/test/testrun_2a.sh
===================================================================
--- /trunk/test/testrun_2a.sh	(revision 462)
+++ /trunk/test/testrun_2a.sh	(revision 463)
@@ -254,5 +254,4 @@
     ####### EXIT HERE FOR TESTING ######
     #
-    exit 0
     #
     SERVER_BUILDOPTS_ORIG="${SERVER_BUILDOPTS}"
