Index: trunk/src/sh_mounts.c
===================================================================
--- trunk/src/sh_mounts.c	(revision 582)
+++ trunk/src/sh_mounts.c	(revision 1)
@@ -51,9 +51,9 @@
 
 /* Prototypes for configuration functions */
-int sh_mounts_config_activate (const char * opt);
-int sh_mounts_config_timer    (const char * opt);
-int sh_mounts_config_mount    (const char * opt);
-int sh_mounts_config_sevmnt   (const char * opt);
-int sh_mounts_config_sevopt   (const char * opt);
+int sh_mounts_config_activate (char * opt);
+int sh_mounts_config_timer    (char * opt);
+int sh_mounts_config_mount    (char * opt);
+int sh_mounts_config_sevmnt   (char * opt);
+int sh_mounts_config_sevopt   (char * opt);
 
 /* Prototype for the function to read info on mounted filesystems */
@@ -157,6 +157,6 @@
 static int    ShMountsActive    = S_FALSE;
 static time_t ShMountsInterval  = 86400;
-static int    ShMountsSevMnt    = SH_ERR_ERR;
-static int    ShMountsSevOpt    = SH_ERR_ERR;
+static int    ShMountsSevMnt    = 7;
+static int    ShMountsSevOpt    = 7;
 
 static struct sh_mounts_mnt *mountlist = NULL;
@@ -165,7 +165,6 @@
  * This is called once at the start of each samhain run.
  * Non-configuration setup code should be placed here. */
-int sh_mounts_init (struct mod_type * arg)
-{
-  (void) arg;
+int sh_mounts_init ()
+{
   SL_ENTER(_("sh_mounts_init"));
 
@@ -180,4 +179,6 @@
   }
 
+  lastcheck = time(NULL);
+
   SL_RETURN(0, _("sh_mounts_init"));
 }
@@ -195,5 +196,5 @@
     SL_RETURN(-1, _("sh_mounts_timer"));
   }
- 
+  
   SL_RETURN(0, _("sh_mounts_timer"));
 }
@@ -261,6 +262,6 @@
 
 /* Module reconfiguration
- * Run on receipt of a HUP.
- */
+ * Run on receipt of a HUP. Right now this is identical to _end(), but it may
+ * not always be. */
 int sh_mounts_reconf()
 {
@@ -268,12 +269,4 @@
   sh_mounts_mnt_free(mountlist);
   mountlist = NULL;
-
-  /* re-set defaults
-   */
-  ShMountsActive    = S_FALSE;
-  ShMountsInterval  = 86400;
-  ShMountsSevMnt    = 7;
-  ShMountsSevOpt    = 7;
-
   SL_RETURN( (0), _("sh_mounts_null"));
 }
@@ -283,9 +276,9 @@
 
 /* Configure to check a particular mount */
-int sh_mounts_config_mount (const char * opt_in)
+int sh_mounts_config_mount (char * opt)
 {
   struct sh_mounts_mnt *m;
   struct sh_mounts_opt *o;
-  char *sp, *temp, *opt;
+  char *sp, *temp;
 
   SL_ENTER(_("sh_mounts_config_mount"));
@@ -293,9 +286,9 @@
   /* It's probably best to make a copy of opt before messing about with it
    * via string functions. Good practice and all that. */
-  temp = sh_util_strdup(opt_in);
+  temp = sh_util_strdup(opt);
 
   /* Since we're going to "consume" this new buffer, it'll be good to have a
    * reference to it's allocated memory so we can free it later. Let's use
-   * temp for that, and "opt" for consumption */
+   * temp for that, and the now-unused "opt" for consumption */
   opt = temp;
   
@@ -334,5 +327,5 @@
 
 /* Simply sets our boolean as to whether this module is active */
-int sh_mounts_config_activate (const char * opt)
+int sh_mounts_config_activate (char * opt)
 {
   int i;
@@ -343,5 +336,5 @@
 
 /* Sets up our timer */
-int sh_mounts_config_timer (const char * opt)
+int sh_mounts_config_timer (char * opt)
 {
   long val;
@@ -364,5 +357,5 @@
 
 /* Configure severity for "mount missing" messages */
-int sh_mounts_config_sevmnt  (const char * opt)
+int sh_mounts_config_sevmnt  (char * opt)
 {
   int retval = 0;
@@ -377,5 +370,5 @@
 }
 
-int sh_mounts_config_sevopt  (const char * opt)
+int sh_mounts_config_sevopt  (char * opt)
 {
   int retval = 0;
@@ -398,5 +391,5 @@
 
 /* FreeBSD includes */
-#if defined(HOST_IS_FREEBSD) || defined(HOST_IS_OPENBSD) || defined(HOST_IS_DARWIN)
+#ifdef HOST_IS_FREEBSD
 #include <sys/param.h>
 #include <sys/ucred.h>
@@ -457,5 +450,6 @@
   
   while ((c = getc (fd)) == '*') {
-    while (((c = getc (fd)) != '\n') && (c != EOF)) {} /* do nothing */
+    while (((c = getc (fd)) != '\n') && (c != EOF)) {
+    }
   }
 }
@@ -572,8 +566,8 @@
 
 /* end AIX helper routines */
-#endif 
-#endif
-
-#if defined(HOST_IS_FREEBSD) || defined(HOST_IS_OPENBSD) || defined(HOST_IS_DARWIN)
+#endif
+#endif
+
+#if defined(HOST_IS_FREEBSD)
 
 /* FreeBSD returns flags instead of strings as mount options, so we'll convert
@@ -585,31 +579,12 @@
 
 	struct {char *opt; int flag;} table[] = {
-#ifdef MNT_RDONLY
 		{"ro",		MNT_RDONLY},
-#endif
-#ifdef MNT_NOEXEC
 		{"noexec",	MNT_NOEXEC},
-#endif
-#ifdef MNT_NOSUID
 		{"nosuid",	MNT_NOSUID},
-#endif
-#ifdef MNT_NODEV
 		{"nodev",	MNT_NODEV},
-#endif
-#ifdef MNT_SYNCHRONOUS
 		{"sync",	MNT_SYNCHRONOUS},
-#endif
-#ifdef MNT_ASYNC
 		{"async",	MNT_ASYNC},
-#endif
-#ifdef MNT_LOCAL
 		{"local",	MNT_LOCAL},
-#endif
-#ifdef MNT_QUOTA
 		{"quota",	MNT_QUOTA},
-#endif
-#ifdef MNT_NOATIME
-		{"noatime",	MNT_NOATIME},
-#endif
 		{"bound",	-1}
 	};
@@ -682,6 +657,6 @@
 	list = m;
 
-/* The Open/FreeBSD way */
-#if defined(HOST_IS_FREEBSD) || defined(HOST_IS_OPENBSD) || defined(HOST_IS_DARWIN)
+/* The FreeBSD way */
+#ifdef HOST_IS_FREEBSD
 {
 	struct statfs *fsp;
@@ -749,5 +724,5 @@
 	}
 
-	sl_fclose(FIL__, __LINE__, tab);
+	fclose(tab);
 }
 #endif
@@ -806,5 +781,5 @@
         }
 
-        (void) sl_fclose(FIL__, __LINE__, tab);
+        (void) fclose(tab);
 	aix_fs_get (NULL, NULL); /* reset */
 }
