Index: /trunk/configure.ac
===================================================================
--- /trunk/configure.ac	(revision 202)
+++ /trunk/configure.ac	(revision 203)
@@ -35,10 +35,4 @@
 AC_SUBST(BUILD_CC)
 
-if test "x$GCC" = "xyes"; then
-   GCC_STACK_PROTECT_LIB
-   GCC_STACK_PROTECT_CC
-   GCC_PIE_CC
-fi
-
 AC_HEADER_STDC
 dnl
@@ -49,5 +43,5 @@
 
 
-AC_MSG_CHECKING([for host-specific issues])
+AC_MSG_CHECKING([for OS specific issues])
 mydebugflag=no
 myneedg3=no
@@ -57,4 +51,5 @@
 sh_use_lcaps="undef"
 dnmalloc_ok=yes
+sh_use_pie=yes
 
 case "$host_os" in
@@ -64,5 +59,5 @@
 	AC_DEFINE(HOST_IS_LINUX)
         AC_DEFINE(HAVE_EXT2_IOCTLS)
-	AC_MSG_RESULT(LINUX use ioctl to get e2fs flags)
+	AC_MSG_RESULT(use ioctl to get e2fs flags)
 	case "$host_cpu" in 
 	   i*86*)
@@ -80,5 +75,5 @@
 	  CFLAGS="$CFLAGS -O2 -assume noaligned_objects"
 	  myneedg3=yes
-	  AC_MSG_RESULT(OSF1 compiler needs assume noaligned_objects)
+	  AC_MSG_RESULT(compiler needs assume noaligned_objects)
 	else
 	  AC_MSG_RESULT(none)
@@ -89,12 +84,27 @@
 	AC_DEFINE(HOST_IS_CYGWIN)
 	dnmalloc_ok=no
-	AC_MSG_RESULT(CYGWIN no trusted paths and no dnmalloc)
+	AC_MSG_RESULT(no trusted paths and no dnmalloc)
 	;;
 
 	*darwin*) 
 	AC_DEFINE(HOST_IS_DARWIN)
-	AC_MSG_RESULT(DARWIN check resource forks)
+	AC_MSG_RESULT(check resource forks)
 	;;
 
+	*freebsd7*)
+	AC_DEFINE(HOST_IS_FREEBSD)
+	selectconfig=freebsd
+	case "$host_cpu" in
+		amd64)
+		sh_use_pie=no
+		dnmalloc_ok=no
+		AC_MSG_RESULT([no dnmalloc and broken compiler toolchain])
+		;;
+		*)
+		AC_MSG_RESULT(none)
+		;;
+	esac
+	;;
+	
 	*freebsd*)
 	AC_DEFINE(HOST_IS_FREEBSD)
@@ -107,5 +117,5 @@
 	selectconfig=freebsd
 	dnmalloc_ok=no
-	AC_MSG_RESULT(OpenBSD dnmalloc does not work with pthreads)
+	AC_MSG_RESULT(dnmalloc does not work with pthreads)
 	;;
 
@@ -113,5 +123,5 @@
 	mynetbsd=yes
 	selectconfig=netbsd
-	AC_MSG_RESULT(NETBSD bug with libresolve)
+	AC_MSG_RESULT(bug with libresolve)
 	;;
 
@@ -122,5 +132,5 @@
 		i*86)
 		AC_DEFINE(HOST_IS_I86SOLARIS)
-		AC_MSG_RESULT(SOLARIS I86 vsnprintf prototype)
+		AC_MSG_RESULT(vsnprintf prototype)
 		;;
 		*)
@@ -195,8 +205,4 @@
 AC_DEFINE_UNQUOTED(UID_CAST, ${uid_cast})
 
-dnl Test whether gcc supports -Wno-empty-body
-dnl Suppresses warnings from glibc pthread_cleanup_pop
-dnl
-GCC_WEMPTY_BODY
 
 
@@ -316,4 +322,6 @@
 		AC_HEADER_EGREP(comp_t,   sys/acct.h, AC_DEFINE(HAVE_COMP_T, ,
 								[Define if <sys/acct.h> uses the COMP_T type.]))
+		AC_HEADER_EGREP([struct acct_v3],   sys/acct.h, AC_DEFINE(HAVE_ACCT_V3, ,
+								[Define if <sys/acct.h> has struct acct_v3.]))
  )
 
@@ -624,4 +632,10 @@
 
 AM_SA_SIGACTION_WORKS
+
+if test "x$GCC" = "xyes"; then
+   GCC_STACK_PROTECT_LIB
+   GCC_STACK_PROTECT_CC
+   GCC_PIE_CC
+fi
 
 dnl *****************************************
@@ -975,11 +989,4 @@
 )
 
-if test x$enable_static = xyes; then
-   :
-else
-   LDFLAGS="$LDFLAGS $PIE_LDFLAGS"
-   CFLAGS="$CFLAGS $PIE_CFLAGS"
-fi
-
 if test x"${mytclient}" = x-DSH_STANDALONE -o x"${mytclient}" = x-DSH_WITH_CLIENT;
 then
@@ -993,4 +1000,14 @@
 	CHECK_ZLIB()
 fi
+
+if test x$enable_static = xyes; then
+   :
+else
+   if test x$sh_use_pie = xyes; then
+      LDFLAGS="$LDFLAGS $PIE_LDFLAGS"
+      CFLAGS="$CFLAGS $PIE_CFLAGS"
+   fi
+fi
+
 	
 #
@@ -1440,5 +1457,14 @@
 			   LIBS="-lpcre $LIBS"
 			   ],
-	                   AC_MSG_ERROR([The --enable-logfile-monitor option requires libpcre. For compiling the pcre development package is needed.])
+			   [
+				AC_CHECK_HEADER(pcre/pcre.h,
+			   	[
+			   	AC_DEFINE(USE_LOGFILE_MONITOR, 1, [Define if you want the logfile monitor module.])
+				AC_DEFINE(HAVE_PCRE_PCRE_H, 1, [Define if you have pcre/pcre.h.])
+			   	LIBS="-lpcre $LIBS"
+			   	],
+	                   	AC_MSG_ERROR([The --enable-logfile-monitor option requires libpcre. For compiling the pcre development package is needed.])
+				)
+			  ]
 	   )
         fi
@@ -1584,4 +1610,9 @@
 
 fi
+
+dnl Test whether gcc supports -Wno-empty-body
+dnl Suppresses warnings from glibc pthread_cleanup_pop
+dnl
+GCC_WEMPTY_BODY
 
 AC_MSG_CHECKING([which random module to use])
Index: /trunk/docs/Changelog
===================================================================
--- /trunk/docs/Changelog	(revision 202)
+++ /trunk/docs/Changelog	(revision 203)
@@ -1,3 +1,7 @@
 2.5.1:
+	* workaround for freebsd7 amd64 lossage (compiler toolchain, 
+	  no mmap to 32bit address space)
+	* samhain-install.sh: check for presence of stealth_template.ps 
+	  before trying to create it
 	* use -Wno-empty-body if supported to suppress warnings about
 	  glibc pthread_cleanup_pop implementation
Index: /trunk/samhain-install.sh.in
===================================================================
--- /trunk/samhain-install.sh.in	(revision 202)
+++ /trunk/samhain-install.sh.in	(revision 203)
@@ -1415,20 +1415,25 @@
 	IFS=${OIFS}
 
-	if test x"${CONVERT}" = x
-	then
-	    echo "${0}: cannot find ImageMagick convert utility in PATH=${PATH}"
-	    exit 1
-        fi
-
-	PATH=${OPATH}
-
- 	if test -f stealth_template.jpg
-	then
-	    test -z "$verbose" || echo "  ${CONVERT} +compress stealth_template.jpg stealth_template.ps"
-	    "${CONVERT}" +compress stealth_template.jpg stealth_template.ps
-	else
-	    echo "${0}: cannot find file stealth_template.jpg"
-	    exit 1
-        fi
+	if test -f stealth_template.ps
+	then
+	    PATH=${OPATH}
+	else
+	    if test x"${CONVERT}" = x
+	    then
+		echo "${0}: cannot find ImageMagick convert utility in PATH=${PATH}"
+		exit 1
+            fi
+
+	    PATH=${OPATH}
+
+ 	    if test -f stealth_template.jpg
+	    then
+		test -z "$verbose" || echo "  ${CONVERT} +compress stealth_template.jpg stealth_template.ps"
+		"${CONVERT}" +compress stealth_template.jpg stealth_template.ps
+	    else
+		echo "${0}: cannot find file stealth_template.jpg"
+		exit 1
+            fi
+	fi
 
 
Index: /trunk/src/make-tests.sh
===================================================================
--- /trunk/src/make-tests.sh	(revision 202)
+++ /trunk/src/make-tests.sh	(revision 203)
@@ -20,4 +20,5 @@
 #include <stdio.h>
 #include "CuTest.h"
+#include "config.h"
 
 '
Index: /trunk/src/samhain.c
===================================================================
--- /trunk/src/samhain.c	(revision 202)
+++ /trunk/src/samhain.c	(revision 203)
@@ -824,5 +824,5 @@
   ino = (long) buf.st_ino;
     
-  if (NULL == (dp = opendir("/proc")))
+  if (NULL == (dp = opendir(_("/proc"))))
     {
       return NULL;
Index: /trunk/src/sh_gpg.c
===================================================================
--- /trunk/src/sh_gpg.c	(revision 202)
+++ /trunk/src/sh_gpg.c	(revision 203)
@@ -257,5 +257,5 @@
   char   cc3[32];
   char   cc4[SH_PATHBUF+32];
-  char   cc5[32] = "--no-tty";
+  char   cc5[32];
 #endif
 
@@ -283,5 +283,6 @@
   /* sl_strlcpy (cc4,   sh.effective.home, SH_PATHBUF+32); */
   sl_strlcpy (cc4,   homedir,           SH_PATHBUF+32);
-  sl_strlcat (cc4,   _("/.gnupg"),      SH_PATHBUF+32); 
+  sl_strlcat (cc4,   _("/.gnupg"),      SH_PATHBUF+32);
+  sl_strlcpy (cc5,   _("--no-tty"),     32);
 
   /* fprintf(stderr, "YULE: homedir=%s\n", homedir); */
@@ -416,5 +417,5 @@
       envp[0] = malloc (len); /* free() ok   */
       if (envp[0] != NULL)
-	sl_snprintf (envp[0], len, "HOME=%s", sh.effective.home); 
+	sl_snprintf (envp[0], len, _("HOME=%s"), sh.effective.home); 
       envp[1] = NULL;
     }
Index: /trunk/src/sh_log_check.c
===================================================================
--- /trunk/src/sh_log_check.c	(revision 202)
+++ /trunk/src/sh_log_check.c	(revision 203)
@@ -14,5 +14,9 @@
 
 /* Debian/Ubuntu: libpcre3-dev */
+#ifdef HAVE_PCRE_PCRE_H
+#include <pcre/pcre.h>
+#else
 #include <pcre.h>
+#endif
 
 #include "samhain.h"
Index: /trunk/src/sh_log_evalrule.c
===================================================================
--- /trunk/src/sh_log_evalrule.c	(revision 202)
+++ /trunk/src/sh_log_evalrule.c	(revision 203)
@@ -15,5 +15,13 @@
 
 /* Debian/Ubuntu: libpcre3-dev */
+#ifdef HAVE_PCRE_PCRE_H
+#include <pcre/pcre.h>
+#else
 #include <pcre.h>
+#endif
+
+#ifndef PCRE_NO_AUTO_CAPTURE
+#define PCRE_NO_AUTO_CAPTURE 0
+#endif
 
 #include "samhain.h"
Index: /trunk/src/sh_log_parse_apache.c
===================================================================
--- /trunk/src/sh_log_parse_apache.c	(revision 202)
+++ /trunk/src/sh_log_parse_apache.c	(revision 203)
@@ -29,5 +29,9 @@
 
 /* Debian/Ubuntu: libpcre3-dev */
+#ifdef HAVE_PCRE_PCRE_H
+#include <pcre/pcre.h>
+#else
 #include <pcre.h>
+#endif
 
 #include "samhain.h"
Index: /trunk/src/sh_log_parse_pacct.c
===================================================================
--- /trunk/src/sh_log_parse_pacct.c	(revision 202)
+++ /trunk/src/sh_log_parse_pacct.c	(revision 203)
@@ -227,5 +227,5 @@
 sh_string * sh_read_pacct (sh_string * record, struct sh_logfile * logfile)
 {
-#if defined(__linux__)
+#if defined(__linux__) && defined(HAVE_ACCT_V3)
 #  define STRUCT_ACCT struct acct_v3
 #else
Index: /trunk/src/sh_processcheck.c
===================================================================
--- /trunk/src/sh_processcheck.c	(revision 202)
+++ /trunk/src/sh_processcheck.c	(revision 203)
@@ -196,5 +196,5 @@
   char *      tmp;
 
-  sl_snprintf (path, sizeof(path), "/proc/%ld/exe", (unsigned long) pid);
+  sl_snprintf (path, sizeof(path), _("/proc/%ld/exe"), (unsigned long) pid);
 
   if (0 == retry_lstat(FIL__, __LINE__, path, &sbuf) && S_ISLNK(sbuf.st_mode))
@@ -203,5 +203,5 @@
     }
 
-  sl_snprintf (path, sizeof(path), "/proc/%ld/file", (unsigned long) pid);
+  sl_snprintf (path, sizeof(path), _("/proc/%ld/file"), (unsigned long) pid);
 
   if (0 == retry_lstat(FIL__, __LINE__, path, &sbuf) && S_ISLNK(sbuf.st_mode))
@@ -210,5 +210,5 @@
     }
 
-  sl_snprintf (path, sizeof(path), "/proc/%ld/path/a.out", (unsigned long) pid);
+  sl_snprintf (path, sizeof(path), _("/proc/%ld/path/a.out"), (unsigned long) pid);
 
   if (0 == retry_lstat(FIL__, __LINE__, path, &sbuf) && S_ISLNK(sbuf.st_mode))
Index: /trunk/src/sh_unix.c
===================================================================
--- /trunk/src/sh_unix.c	(revision 202)
+++ /trunk/src/sh_unix.c	(revision 203)
@@ -2083,5 +2083,5 @@
       int r;
 
-      while((r = waitpid(pid, &status, WCONTINUED|WUNTRACED)) != pid && r != -1) ;
+      while((r = waitpid(pid, &status, WUNTRACED)) != pid && r != -1) ;
 
 #if !defined(USE_UNO)
Index: /trunk/src/sh_userfiles.c
===================================================================
--- /trunk/src/sh_userfiles.c	(revision 202)
+++ /trunk/src/sh_userfiles.c	(revision 203)
@@ -215,16 +215,16 @@
      * So, compare longest strings first */
     if( s == NULL ) /* The default */          new->level = default_level;
-    else if ( strstr(s, "attributes")!= NULL ) new->level = SH_LEVEL_ATTRIBUTES;
-    else if ( strstr(s, "allignore") != NULL ) new->level = SH_LEVEL_ALLIGNORE;
-    else if ( strstr(s, "noignore")  != NULL ) new->level = SH_LEVEL_NOIGNORE;
-    else if ( strstr(s, "logfiles")  != NULL ) new->level = SH_LEVEL_LOGFILES;
-    else if ( strstr(s, "readonly")  != NULL ) new->level = SH_LEVEL_READONLY;
-    else if ( strstr(s, "loggrow")   != NULL ) new->level = SH_LEVEL_LOGGROW;
-    else if ( strstr(s, "user0")     != NULL ) new->level = SH_LEVEL_USER0;
-    else if ( strstr(s, "user1")     != NULL ) new->level = SH_LEVEL_USER1;
-    else if ( strstr(s, "user2")     != NULL ) new->level = SH_LEVEL_USER2;
-    else if ( strstr(s, "user3")     != NULL ) new->level = SH_LEVEL_USER3;
-    else if ( strstr(s, "user4")     != NULL ) new->level = SH_LEVEL_USER4;
-    else if ( strstr(s, "prelink")   != NULL ) new->level = SH_LEVEL_PRELINK;
+    else if ( strstr(s, _("attributes"))!= NULL ) new->level = SH_LEVEL_ATTRIBUTES;
+    else if ( strstr(s, _("allignore")) != NULL ) new->level = SH_LEVEL_ALLIGNORE;
+    else if ( strstr(s, _("noignore"))  != NULL ) new->level = SH_LEVEL_NOIGNORE;
+    else if ( strstr(s, _("logfiles"))  != NULL ) new->level = SH_LEVEL_LOGFILES;
+    else if ( strstr(s, _("readonly"))  != NULL ) new->level = SH_LEVEL_READONLY;
+    else if ( strstr(s, _("loggrow"))   != NULL ) new->level = SH_LEVEL_LOGGROW;
+    else if ( strstr(s, _("user0"))     != NULL ) new->level = SH_LEVEL_USER0;
+    else if ( strstr(s, _("user1"))     != NULL ) new->level = SH_LEVEL_USER1;
+    else if ( strstr(s, _("user2"))     != NULL ) new->level = SH_LEVEL_USER2;
+    else if ( strstr(s, _("user3"))     != NULL ) new->level = SH_LEVEL_USER3;
+    else if ( strstr(s, _("user4"))     != NULL ) new->level = SH_LEVEL_USER4;
+    else if ( strstr(s, _("prelink"))   != NULL ) new->level = SH_LEVEL_PRELINK;
     else            /* The default */          new->level = default_level;
 
Index: /trunk/src/slib.c
===================================================================
--- /trunk/src/slib.c	(revision 202)
+++ /trunk/src/slib.c	(revision 203)
@@ -1094,5 +1094,5 @@
 {
 #ifndef HAVE_STRSTR
-  insigned int    i;
+  unsigned int    i;
   size_t          needle_len;
   size_t          haystack_len;
Index: /trunk/test/testhash.sh
===================================================================
--- /trunk/test/testhash.sh	(revision 202)
+++ /trunk/test/testhash.sh	(revision 203)
@@ -37,5 +37,5 @@
 	fi
 	#
-	${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 --enable-debug --enable-logfile-monitor
+	${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 --enable-debug
 	#
 	fail=0
