Index: trunk/depend.dep
===================================================================
--- trunk/depend.dep	(revision 171)
+++ trunk/depend.dep	(revision 172)
@@ -67,2 +67,3 @@
 t-test1.o: $(srcsrc)/t-test1.c Makefile config.h $(srcinc)/malloc.h 
 dnmalloc-portable.o: $(srcsrc)/dnmalloc-portable.c Makefile config.h 
+dnmalloc.o: $(srcsrc)/dnmalloc.c Makefile config.h 
Index: trunk/depend.sum
===================================================================
--- trunk/depend.sum	(revision 171)
+++ trunk/depend.sum	(revision 172)
@@ -1,1 +1,1 @@
-1541929809
+1366887748
Index: trunk/docs/Changelog
===================================================================
--- trunk/docs/Changelog	(revision 171)
+++ trunk/docs/Changelog	(revision 172)
@@ -1,7 +1,13 @@
 2.4.5:
+	* testscripts: 'chmod -R' -> 'chmod -f -R', since Solaris 10
+	  bails out on a chmod on a dangling link
+	* fix bug in check_samhain.pl nagios script (J.-S. Eon)
+	* use the UNO static checker
+	* compile as position independent executable (PIE)
 	* handle EINPROGRESS error (Windows/cygwin issue)
 	* make sure every function uses less than one page of stack
 	  (proactive security against gap jumping, Gael Delalleau) 
 	* use dnmalloc instead of system malloc
+	  (proactive security against heap buffer overflows)
 	* fix dnmalloc bugs and portability problems
 	* check for compressBound, since older zlibs don't have it
Index: trunk/src/dnmalloc.c
===================================================================
--- trunk/src/dnmalloc.c	(revision 171)
+++ trunk/src/dnmalloc.c	(revision 172)
@@ -1,4 +1,6 @@
 /* DistriNet malloc (dnmalloc): a more secure memory allocator. 
-   Copyright (C) 2005, Yves Younan, Wouter Joosen, Frank Piessens and Rainer Wichmann
+   Copyright (C) 2005, Yves Younan, Wouter Joosen, Frank Piessens 
+   and Rainer Wichmann
+
    The authors can be contacted by:
       Email: dnmalloc@fort-knox.org
@@ -25,5 +27,5 @@
 */
 
-/* Current version: dnmalloc 1.0  */
+/* Current version: dnmalloc 1.0 */
 /* Includes arc4random from OpenBSD, which is under the BDS license     */
 
@@ -93,4 +95,10 @@
 	       works on OpenBSD.
    
+   further to 1.0:
+   Valgrind client requests inserted (#define USE_VALGRIND)
+   Fix malloc_consolidate (nextchunk->fd, nextchunk->bck may be NULL)
+   Portability: minsize = 32 bit on 64bit architecture
+   Minor cleanups
+
    There may be some bugs left in this version. please use with caution.
 */
@@ -176,4 +184,18 @@
 #endif
 
+#ifdef USE_VALGRIND
+#include <valgrind/memcheck.h>
+#else
+#define VALGRIND_FREELIKE_BLOCK(a,b)       ((void)0)
+#define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d) ((void)0)
+#define VALGRIND_CREATE_MEMPOOL(a,b,c)     ((void)0)
+#define VALGRIND_MEMPOOL_ALLOC(a,b,c)      ((void)0)
+#define VALGRIND_MEMPOOL_FREE(a,b)         ((void)0)
+#define VALGRIND_DESTROY_MEMPOOL(a)        ((void)0)
+#define VALGRIND_MAKE_MEM_DEFINED(a,b)     ((void)0)
+#define VALGRIND_MAKE_MEM_UNDEFINED(a,b)   ((void)0)
+#define VALGRIND_MAKE_MEM_NOACCESS(a,b)    ((void)0)
+#endif
+
 #if defined (__GNUC__) && __GNUC__ > 2
 # define LIKELY(expression) (__builtin_expect(!!(expression), 1))
@@ -277,5 +299,4 @@
 #endif
 
-#if !defined(SAMHAIN) 
 static void default_assert_handler(const char *error, 
 				   const char *file, int line)
@@ -300,12 +321,9 @@
   fputc('\n', stderr);
 #endif
+  (void) line;
   abort();
 }
 static assert_handler_tp *assert_handler = default_assert_handler;
-#else
-extern void safe_fatal(const char *error, 
-		       const char *file, int line);
-static assert_handler_tp *assert_handler = safe_fatal;
-#endif
+
 
 #define assert(x)                               \
@@ -337,5 +355,5 @@
   /* #define DNMALLOC_DEBUG */ 
 
-  /* Do some extra checks? */
+  /* Do some extra checks? if not, covered by assrt()s */
   /* #define DNMALLOC_CHECKS */
 
@@ -668,9 +686,5 @@
 
 #ifndef HAVE_MMAP
-#  ifdef SAMHAIN
-#    error mmap not available, use --disable-dnmalloc
-#  else
-#    error HAVE_MMAP not defined, has your operating system mmap?
-#  endif
+#  error HAVE_MMAP not defined, has your operating system mmap?
 #endif
 
@@ -1898,4 +1912,5 @@
   guard_set_p = (char*)(chunk(P));                                \
   guard_set_p += request;                                         \
+  VALGRIND_MAKE_MEM_UNDEFINED(guard_set_p,GUARD_SIZE);            \
   guard_set_q = (char*)(guard);                                   \
   *guard_set_p = *guard_set_q; ++guard_set_p; ++guard_set_q;      \
@@ -1903,8 +1918,11 @@
   *guard_set_p = *guard_set_q; ++guard_set_p; ++guard_set_q;      \
   *guard_set_p = *guard_set_q;                                    \
+  VALGRIND_MAKE_MEM_NOACCESS((((char*)chunk(P))+request),GUARD_SIZE);	\
   (P)->req = request
  
 #define guard_check(guard, P)				          \
-  assert(0 == memcmp((((char *)chunk(P))+(P)->req),(void*)(guard),GUARD_SIZE));
+  VALGRIND_MAKE_MEM_DEFINED((((char *)chunk(P))+(P)->req), GUARD_SIZE); \
+  assert(0 == memcmp((((char *)chunk(P))+(P)->req),(void*)(guard),GUARD_SIZE));\
+  VALGRIND_MAKE_MEM_NOACCESS((((char *)chunk(P))+(P)->req), GUARD_SIZE);
 
 #else
@@ -2164,13 +2182,6 @@
 /* #define FIRST_SORTED_BIN_SIZE 65536 */
 
-/*          12288 1m59 1m58 1m58
- *           2560 1m56 1m59 1m57
- * MIN_LARGE_SIZE 2m01 1m56 1m57
- */
-#ifdef SAMHAIN
-#define FIRST_SORTED_BIN_SIZE 2560
-#else
 #define FIRST_SORTED_BIN_SIZE MIN_LARGE_SIZE
-#endif
+
 
 /*
@@ -2372,5 +2383,11 @@
 
 /* Minimum size of a chunk */
-#define MINCHUNKSIZE 16
+
+#if (SIZEOF_UNSIGNED_LONG == 8) || defined(__arch64__) || defined(__ia64__) || defined(__x86_64__) || defined(__LP64__) || defined(__64BIT__) || defined(_LP64) || defined(_M_IA64) || (defined(_MIPS_SZLONG) && (_MIPS_SZLONG == 64))
+#  define MINCHUNKSIZE 32
+#else
+#  define MINCHUNKSIZE 16
+#endif
+
 
 /* The amount of hashtable entries for each page:
@@ -2542,4 +2559,5 @@
 	   firstciinfo = currciinfo;
    totalcictr++;
+   VALGRIND_CREATE_MEMPOOL(newcireg, 0, 0);
 }
 
@@ -2567,16 +2585,19 @@
    if (freelst)
    {
-      freeci = freelst;
-      newciinfo->freelist = freelst->fd;
-      newciinfo->freecounter--;
-      /* memset(freeci, 0, sizeof(struct chunkinfo)); */
-      freeci->prev_size = 0;
-      freeci->size      = 0;
-      freeci->req       = 0;
-      freeci->hash_next = NULL;
-      freeci->fd        = NULL;
-      freeci->bk        = NULL;
-      freeci->chunk     = NULL;
-      return (freeci);
+     freeci = freelst;
+     newciinfo->freecounter--;
+     newciinfo->freelist = freelst->fd;
+     
+     VALGRIND_MEMPOOL_ALLOC((char*)currciinfo, (char*)freeci, 
+			    sizeof(struct chunkinfo));
+     
+     freeci->prev_size = 0;
+     freeci->size      = 0;
+     freeci->req       = 0;
+     freeci->hash_next = NULL;
+     freeci->fd        = NULL;
+     freeci->bk        = NULL;
+     freeci->chunk     = NULL;
+     return (freeci);
    }
    else
@@ -2591,4 +2612,8 @@
      currciinfo->freecounter--;
      currciinfo->position++;
+
+     VALGRIND_MEMPOOL_ALLOC((char*)currciinfo, (char*)freeci, 
+			    sizeof(struct chunkinfo));
+
      return (freeci);
    }
@@ -2600,4 +2625,5 @@
   struct cireginfo *prevciinfo = firstciinfo;
   void *unmapme;
+
   while (newciinfo && newciinfo != freeme) {
     prevciinfo = newciinfo;
@@ -2609,4 +2635,5 @@
     prevciinfo->next = newciinfo->next;
   unmapme = (void *) ((char*)freeme - PGSIZE);
+  VALGRIND_DESTROY_MEMPOOL((char*)freeme);
 #if PARANOIA > 1
   munmap(unmapme, CIREGSIZE+(2*PGSIZE));
@@ -2620,4 +2647,5 @@
 
   struct cireginfo *newciinfo;
+
   newciinfo = currciinfo;
   if (((chunkinfoptr) newciinfo < p) && (p  <  (chunkinfoptr) (newciinfo+NUMBER_FREE_CHUNKS))) {
@@ -2625,4 +2653,10 @@
     newciinfo->freelist = p;
     newciinfo->freecounter++;
+    VALGRIND_MEMPOOL_FREE((char*)newciinfo, (char*)p);
+    VALGRIND_MAKE_MEM_DEFINED(p,sizeof(struct chunkinfo));
+    VALGRIND_MAKE_MEM_NOACCESS(p->size,     sizeof(INTERNAL_SIZE_T));
+    VALGRIND_MAKE_MEM_NOACCESS(p->req,      sizeof(INTERNAL_SIZE_T));
+    VALGRIND_MAKE_MEM_NOACCESS(p->bk,       sizeof(struct chunkinfo*));
+    VALGRIND_MAKE_MEM_NOACCESS(p->chunk,    sizeof(mchunkptr));
   } else {
     newciinfo = firstciinfo;
@@ -2633,4 +2667,10 @@
 	  newciinfo->freelist = p;
 	  newciinfo->freecounter++;
+	  VALGRIND_MEMPOOL_FREE((char*)newciinfo, (char*)p);
+	  VALGRIND_MAKE_MEM_DEFINED(p,sizeof(struct chunkinfo));
+	  VALGRIND_MAKE_MEM_NOACCESS(p->size,     sizeof(INTERNAL_SIZE_T));
+	  VALGRIND_MAKE_MEM_NOACCESS(p->req,      sizeof(INTERNAL_SIZE_T));
+	  VALGRIND_MAKE_MEM_NOACCESS(p->bk,       sizeof(struct chunkinfo*));
+	  VALGRIND_MAKE_MEM_NOACCESS(p->chunk,    sizeof(mchunkptr));
 	  if (UNLIKELY(newciinfo->freecounter == NUMBER_FREE_CHUNKS))
 	    freeciregion(newciinfo);
@@ -2738,4 +2778,5 @@
    }
    else {
+
       ci_insert->hash_next = ci_orig->hash_next;
       ci_orig->hash_next = ci_insert;
@@ -2797,5 +2838,7 @@
 }
 
-/* mmapped chunks are multiples of pagesize, no hash_nexts, just remove from the hashtable */
+/* mmapped chunks are multiples of pagesize, no hash_nexts, 
+ * just remove from the hashtable 
+ */
 #define hashtable_remove_mmapped(p) hashtable[hash(p)] = 0;
 
@@ -2807,5 +2850,5 @@
    
 #ifdef DNMALLOC_DEBUG
-   fprintf(stderr, "hashtable_ski: %p, %lu\n", chunk(ci_todelete), hash(chunk(ci_todelete)));
+   fprintf(stderr, "hashtable_skiprm: %p, %lu\n", chunk(ci_todelete), hash(chunk(ci_todelete)));
 #endif
 
@@ -3260,4 +3303,5 @@
 
   if (have_fastchunks(av)) {
+    Void_t * retval;
     assert(in_smallbin_range(nb));
     malloc_consolidate(av);
@@ -3265,5 +3309,7 @@
     fprintf(stderr, "Return sysmalloc have_fastchunks\n");
 #endif
-    return mALLOc(nb - MALLOC_ALIGN_MASK);
+    retval = mALLOc(nb - MALLOC_ALIGN_MASK);
+    VALGRIND_FREELIKE_BLOCK(retval, 0);
+    return retval;
   }
 
@@ -3296,4 +3342,6 @@
       if (mm != (char*)(MORECORE_FAILURE)) {
         
+	VALGRIND_MAKE_MEM_NOACCESS(mm,size);
+
         /*
           The offset to the start of the mmapped region is stored
@@ -3404,4 +3452,5 @@
   if (brk != (char*)(MORECORE_FAILURE)) {
     av->sbrked_mem += size;
+    VALGRIND_MAKE_MEM_NOACCESS(brk,size);
   }
 
@@ -3430,4 +3479,6 @@
       if (brk != (char*)(MORECORE_FAILURE)) {
         
+	VALGRIND_MAKE_MEM_NOACCESS(brk,size);
+
 	av->mmapped_mem += size;
 #ifdef DNMALLOC_DEBUG
@@ -3574,4 +3625,7 @@
           set_noncontiguous(av);
         }
+	else {
+	  VALGRIND_MAKE_MEM_NOACCESS(snd_brk,correction);
+	}
 
       }
@@ -3673,4 +3727,5 @@
 	    set_head(old_top, old_size | PREV_INUSE | INUSE);
 	    guard_set(av->guard_stored, old_top, 0, old_size);
+	    VALGRIND_MALLOCLIKE_BLOCK(chunk(old_top), old_size, 0, 0);
             fREe(chunk(old_top));
             av->trim_threshold = tt;
@@ -3885,4 +3940,5 @@
       check_remalloced_chunk(victim, nb);
       guard_set(av->guard_stored, victim, bytes, nb);
+      VALGRIND_MALLOCLIKE_BLOCK(chunk(victim), bytes, 0, 0);
       return chunk(victim);
     }
@@ -3910,4 +3966,5 @@
       check_malloced_chunk(victim, nb);
       guard_set(av->guard_stored, victim, bytes, nb);
+      VALGRIND_MALLOCLIKE_BLOCK(chunk(victim), bytes, 0, 0);
       return chunk(victim);
     }
@@ -3970,4 +4027,5 @@
       check_malloced_chunk(victim, nb);
       guard_set(av->guard_stored, victim, bytes, nb);
+      VALGRIND_MALLOCLIKE_BLOCK(chunk(victim), bytes, 0, 0);
       return chunk(victim);
     }
@@ -3983,4 +4041,5 @@
       check_malloced_chunk(victim, nb);
       guard_set(av->guard_stored, victim, bytes, nb);
+      VALGRIND_MALLOCLIKE_BLOCK(chunk(victim), bytes, 0, 0);
       return chunk(victim);
     }
@@ -4058,4 +4117,5 @@
 	    check_malloced_chunk(victim, nb);
 	    guard_set(av->guard_stored, victim, bytes, nb);
+	    VALGRIND_MALLOCLIKE_BLOCK(chunk(victim), bytes, 0, 0);
 	    return chunk(victim);
 	  } 
@@ -4065,4 +4125,5 @@
 	    check_malloced_chunk(victim, nb);
 	    guard_set(av->guard_stored, victim, bytes, nb);
+	    VALGRIND_MALLOCLIKE_BLOCK(chunk(victim), bytes, 0, 0);
 	    return chunk(victim);
 	  }
@@ -4140,6 +4201,6 @@
         remainder->bk = remainder->fd = unsorted_chunks(av);
         /* advertise as last remainder */
-        if (in_smallbin_range(nb)) 
-          av->last_remainder = remainder; 
+        if (in_smallbin_range(nb))
+	  av->last_remainder = remainder;
         
         set_head(victim, nb | PREV_INUSE | INUSE);
@@ -4148,4 +4209,5 @@
         check_malloced_chunk(victim, nb);
 	guard_set(av->guard_stored, victim, bytes, nb);
+	VALGRIND_MALLOCLIKE_BLOCK(chunk(victim), bytes, 0, 0);
         return chunk(victim);
       }
@@ -4155,4 +4217,5 @@
         check_malloced_chunk(victim, nb);
 	guard_set(av->guard_stored, victim, bytes, nb);
+	VALGRIND_MALLOCLIKE_BLOCK(chunk(victim), bytes, 0, 0);
         return chunk(victim);
       }
@@ -4183,5 +4246,5 @@
   
   if ((CHUNK_SIZE_T)(size) >= (CHUNK_SIZE_T)(nb + MINSIZE)) {
-     remainder = cireg_getfree();
+    remainder = cireg_getfree();
     remainder_size = size - nb;
     remainder->chunk = chunk_at_offset(chunk(victim), nb);
@@ -4192,4 +4255,5 @@
     check_malloced_chunk(victim, nb);
     guard_set(av->guard_stored, victim, bytes, nb);
+    VALGRIND_MALLOCLIKE_BLOCK(chunk(victim), bytes, 0, 0);
     return chunk(victim);
   }
@@ -4203,4 +4267,5 @@
     guard_set(av->guard_stored, victim, bytes, nb);
   }
+  VALGRIND_MALLOCLIKE_BLOCK(retval, bytes, 0, 0);
   return retval;
 }
@@ -4254,6 +4319,8 @@
       }
 
+    VALGRIND_FREELIKE_BLOCK(mem, 0);
+ 
     guard_check(av->guard_stored, p);
-
+    
     size = chunksize(p);
 
@@ -4471,4 +4538,5 @@
   */
   if (av && av->max_fast != 0) {
+
     clear_fastchunks(av);
 
@@ -4529,10 +4597,15 @@
 	      clear_previnuse(nextchunk);
             
+	      /* if mmap is used instead of sbrk, we may have a
+	       * chunk with !nextchunk->fd && !nextchunk->bk
+	       */
 	      if (!inuse(nextchunk)) {
-		size += nextsize;
-		unlink(nextchunk, bck, fwd);
-		set_head(p, size | PREV_INUSE);
-		hashtable_skiprm(p,nextchunk);
-		freecilst_add(nextchunk);
+		if( nextchunk->fd && nextchunk->bk) {
+		  size += nextsize;
+		  unlink(nextchunk, bck, fwd);
+		  set_head(p, size | PREV_INUSE);
+		  hashtable_skiprm(p,nextchunk);
+		  freecilst_add(nextchunk);
+		}
 	      }
 	      
@@ -4551,5 +4624,5 @@
 	    }
           
-	    else {
+	    else if (nextchunk == av->top) {
 	      size += nextsize;
 	      set_head(p, size | PREV_INUSE);
@@ -4558,5 +4631,5 @@
 	      av->top = p;
 	    }
-	  }
+	  } /* if (nextchunk) */
           
         } while ( (p = nextp) != 0);
@@ -4646,4 +4719,5 @@
   }
 
+  VALGRIND_FREELIKE_BLOCK(oldmem, 0);
   guard_check(av->guard_stored, oldp);
 
@@ -4675,4 +4749,5 @@
          hashtable_insert(oldp, av->top);
 	 guard_set(av->guard_stored, oldp, bytes, nb);
+	 VALGRIND_MALLOCLIKE_BLOCK(chunk(oldp), bytes, 0, 0); 
          return chunk(oldp);
       }
@@ -4696,5 +4771,5 @@
 
         newmem = mALLOc(nb - MALLOC_ALIGN_MASK);
-        if (newmem == 0)
+         if (newmem == 0)
           return 0; /* propagate failure */
 
@@ -4702,4 +4777,5 @@
         newsize = chunksize(newp);
 	
+ 
         /* next = next_chunkinfo(oldp); *//* 'next' never used rw 19.05.2008 */
         /*
@@ -4720,4 +4796,6 @@
           */
           
+	  VALGRIND_MALLOCLIKE_BLOCK(chunk(oldp), chunksize(oldp), 0, 0);
+
           copysize = oldsize;
           s = (INTERNAL_SIZE_T*)(oldmem);
@@ -4774,4 +4852,5 @@
       set_all_inuse(remainder);
       guard_set(av->guard_stored, remainder, 0, remainder_size);
+      VALGRIND_MALLOCLIKE_BLOCK(chunk(remainder), remainder_size, 0, 0);
       fREe(chunk(remainder)); 
     }
@@ -4783,4 +4862,5 @@
     check_inuse_chunk(newp);
     guard_set(av->guard_stored, newp, bytes, nb);
+    VALGRIND_MALLOCLIKE_BLOCK(chunk(newp), bytes, 0, 0);
     return chunk(newp);
   }
@@ -4798,4 +4878,5 @@
     CHUNK_SIZE_T  sum;
     
+
     /* Note the extra SIZE_SZ overhead */
     //newsize = (nb + offset + SIZE_SZ + pagemask) & ~pagemask;
@@ -4806,4 +4887,6 @@
       {
 	guard_set(av->guard_stored, oldp, bytes, nb);
+	VALGRIND_FREELIKE_BLOCK(oldmem, 0);
+	VALGRIND_MALLOCLIKE_BLOCK(oldmem, bytes, 0, 0);
 	return oldmem;
       }
@@ -4832,4 +4915,6 @@
       
       guard_set(av->guard_stored, oldp, bytes, nb);
+      VALGRIND_FREELIKE_BLOCK(oldmem, 0);
+      VALGRIND_MALLOCLIKE_BLOCK(chunk(oldp), bytes, 0, 0);
       return chunk(oldp);
     }
@@ -4847,4 +4932,5 @@
       }
     }
+    VALGRIND_MALLOCLIKE_BLOCK(newmem, bytes, 0, 0);
     guard_set(av->guard_stored, mem2chunk(newmem), bytes, nb);
     return newmem;
Index: trunk/src/make-tests.sh
===================================================================
--- trunk/src/make-tests.sh	(revision 171)
+++ trunk/src/make-tests.sh	(revision 172)
@@ -57,7 +57,15 @@
 int main(void)
 {
+#if !defined(USE_SYSTEM_MALLOC)
+    typedef void assert_handler_tp(const char * error, const char *file, int line);
+    extern assert_handler_tp *dnmalloc_set_handler(assert_handler_tp *new);
+    extern void safe_fatal  (const char * details, const char *f, int l);
+#endif
 #if !defined(USE_SYSTEM_MALLOC) && defined(USE_MALLOC_LOCK)
     extern int dnmalloc_pthread_init(void);
     dnmalloc_pthread_init();
+#endif
+#if !defined(USE_SYSTEM_MALLOC)
+    (void) dnmalloc_set_handler(safe_fatal);
 #endif
     int retval;
Index: trunk/src/samhain.c
===================================================================
--- trunk/src/samhain.c	(revision 171)
+++ trunk/src/samhain.c	(revision 172)
@@ -1220,4 +1220,10 @@
   int     my_argc = 0;
   char  * my_argv[32];
+#endif
+
+#if !defined(USE_SYSTEM_MALLOC)
+  typedef void assert_handler_tp(const char * error, const char *file, int line);
+  extern assert_handler_tp *dnmalloc_set_handler(assert_handler_tp *new);
+  (void) dnmalloc_set_handler(safe_fatal);
 #endif
 
Index: trunk/src/sh_unix.c
===================================================================
--- trunk/src/sh_unix.c	(revision 171)
+++ trunk/src/sh_unix.c	(revision 172)
@@ -557,5 +557,5 @@
 #endif
 {
-#if defined(SL_DEBUG)
+#if defined(SL_DEBUG) && (defined(USE_SYSTEM_MALLOC) || !defined(USE_MALLOC_LOCK))
   int retval;
 #endif
@@ -576,5 +576,5 @@
   /* Check whether the heap is ok; otherwise _exit 
    */
-#if !defined(SL_DEBUG)
+#if !defined(SL_DEBUG) || (!defined(USE_SYSTEM_MALLOC) && defined(USE_MALLOC_LOCK))
   ++immediate_exit_fast;
   if (skey != NULL && immediate_exit_fast < 2)
Index: trunk/test/test.sh
===================================================================
--- trunk/test/test.sh	(revision 171)
+++ trunk/test/test.sh	(revision 172)
@@ -435,5 +435,5 @@
     rm -f ./.samhain_log*
     rm -f ./.samhain_lock*
-    test -d testrun_testdata && chmod -R 0700 testrun_testdata
+    test -d testrun_testdata && chmod -f -R 0700 testrun_testdata
     test -d .quarantine && rm -rf .quarantine
     rm -rf testrun_testdata
Index: trunk/test/testcompile.sh
===================================================================
--- trunk/test/testcompile.sh	(revision 171)
+++ trunk/test/testcompile.sh	(revision 172)
@@ -98,7 +98,7 @@
     #
     cd src/
-    stat=`uno -DUSE_UNO=1 -t -I. -I.. -I../include sh_*.c samhain.c slib.c dnmalloc-portable.c zAVLTree.c trustfile.c rijndael-*.c bignum.c 2>&1 | wc -l`
+    stat=`uno -DHAVE_MMAP=1 -DUSE_UNO=1 -t -I. -I.. -I../include sh_*.c samhain.c slib.c dnmalloc.c zAVLTree.c trustfile.c rijndael-*.c bignum.c 2>&1 | wc -l`
     if [ $stat -ne 1 ]; then
-	uno -DSH_WITH_CLIENT -DSH_WITH_SERVER -DUSE_UNO=1 -t -I. -I.. -I../include sh_*.c samhain.c slib.c dnmalloc-portable.c zAVLTree.c trustfile.c rijndael-*.c bignum.c >>../test_log 2>&1
+	uno -DSH_WITH_CLIENT -DSH_WITH_SERVER -DHAVE_MMAP=1 -DUSE_UNO=1 -t -I. -I.. -I../include sh_*.c samhain.c slib.c dnmalloc.c zAVLTree.c trustfile.c rijndael-*.c bignum.c >>../test_log 2>&1
 	retval=1
 	[ -z "$quiet" ] && log_fail $2 ${MAXTEST} "$TEST (uno)";
@@ -232,10 +232,13 @@
 
 	if [ "x$doall" = xon ]; then
-	    if [ -f /usr/local/gcc-smatch/bin/gcc ]; then  # FIXME
-		SAVE_CC="${CC}"
-		SMATCH="DBGDEF=--smatch"; export SMATCH
-		SAVE_SMATCH="${SMATCH}"; export SAVE_SMATCH
-		CC="/usr/local/gcc-smatch/bin/gcc"; export CC
-		SMATCH_CC="${CC}"
+	    uname -a | grep x86_64 >/dev/null 
+	    if [ $? -ne 0 ]; then
+		if [ -f /usr/local/gcc-smatch/bin/gcc ]; then  # FIXME
+		    SAVE_CC="${CC}"
+		    SMATCH="DBGDEF=--smatch"; export SMATCH
+		    SAVE_SMATCH="${SMATCH}"; export SAVE_SMATCH
+		    CC="/usr/local/gcc-smatch/bin/gcc"; export CC
+		    SMATCH_CC="${CC}"
+		fi
 	    fi
 	fi
Index: trunk/test/testrun_1.sh
===================================================================
--- trunk/test/testrun_1.sh	(revision 171)
+++ trunk/test/testrun_1.sh	(revision 172)
@@ -1116,6 +1116,6 @@
     if test -d "$BASE"; then
 	if [ -d "${BASE}" ]; then
-	    chmod -R 0700 "${BASE}" || {
-		[ -z "$quiet" ] &&   log_msg_fail "chmod -R 0700 ${BASE}"; 
+	    chmod -f -R 0700 "${BASE}" || {
+		[ -z "$quiet" ] &&   log_msg_fail "chmod -f -R 0700 ${BASE}"; 
 		return 1;
 	    }
Index: trunk/test/testrun_2a.sh
===================================================================
--- trunk/test/testrun_2a.sh	(revision 171)
+++ trunk/test/testrun_2a.sh	(revision 172)
@@ -23,7 +23,7 @@
 RCFILE="$PW_DIR/testrc_2";  export RCFILE
 
-SERVER_BUILDOPTS="--quiet  $TRUST  --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST}  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export SERVER_BUILDOPTS
-
-CLIENT_BUILDOPTS="--quiet  $TRUST --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$RCFILE --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --enable-suidcheck"; export CLIENT_BUILDOPTS
+SERVER_BUILDOPTS="--quiet  $TRUST --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST}  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export SERVER_BUILDOPTS
+
+CLIENT_BUILDOPTS="--quiet  $TRUST --enable-network=client --enable-srp --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$RCFILE --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --enable-suidcheck"; export CLIENT_BUILDOPTS
 
 do_test_1_a () {
@@ -250,6 +250,6 @@
     CLIENT_BUILDOPTS_ORIG="${CLIENT_BUILDOPTS}"
     #
-    SERVER_BUILDOPTS="${SERVER_BUILDOPTS_ORIG} --disable-srp"
-    CLIENT_BUILDOPTS="${CLIENT_BUILDOPTS_ORIG} --disable-srp"
+    SERVER_BUILDOPTS="${SERVER_BUILDOPTS_ORIG} --disable-srp"; export SERVER_BUILDOPTS
+    CLIENT_BUILDOPTS="${CLIENT_BUILDOPTS_ORIG} --disable-srp"; export CLIENT_BUILDOPTS
     #
     testrun2a_internal
@@ -261,6 +261,6 @@
     fi
     #
-    SERVER_BUILDOPTS="${SERVER_BUILDOPTS_ORIG} --disable-encrypt"
-    CLIENT_BUILDOPTS="${CLIENT_BUILDOPTS_ORIG} --disable-encrypt"
+    SERVER_BUILDOPTS="${SERVER_BUILDOPTS_ORIG} --disable-encrypt"; export SERVER_BUILDOPTS
+    CLIENT_BUILDOPTS="${CLIENT_BUILDOPTS_ORIG} --disable-encrypt"; export CLIENT_BUILDOPTS
     #
     testrun2a_internal
@@ -272,6 +272,6 @@
     fi
     #
-    SERVER_BUILDOPTS="${SERVER_BUILDOPTS_ORIG} --enable-encrypt=1"
-    CLIENT_BUILDOPTS="${CLIENT_BUILDOPTS_ORIG} --enable-encrypt=1"
+    SERVER_BUILDOPTS="${SERVER_BUILDOPTS_ORIG} --enable-encrypt=1"; export SERVER_BUILDOPTS
+    CLIENT_BUILDOPTS="${CLIENT_BUILDOPTS_ORIG} --enable-encrypt=1"; export CLIENT_BUILDOPTS
     #
     testrun2a_internal
@@ -283,6 +283,6 @@
     fi
     #
-    SERVER_BUILDOPTS="${SERVER_BUILDOPTS_ORIG}"
-    CLIENT_BUILDOPTS="${CLIENT_BUILDOPTS_ORIG} --enable-encrypt=1"
+    SERVER_BUILDOPTS="${SERVER_BUILDOPTS_ORIG}"; export SERVER_BUILDOPTS
+    CLIENT_BUILDOPTS="${CLIENT_BUILDOPTS_ORIG} --enable-encrypt=1"; export CLIENT_BUILDOPTS
     #
     testrun2a_internal
Index: trunk/test/testtimesrv.sh
===================================================================
--- trunk/test/testtimesrv.sh	(revision 171)
+++ trunk/test/testtimesrv.sh	(revision 172)
@@ -31,6 +31,6 @@
 {
     if test -d "$BASE"; then
-	chmod -R 0700 "${BASE}" || {
-	    [ -z "$quiet" ] &&   log_msg_fail "chmod -R 0700 ${BASE}"; 
+	chmod -f -R 0700 "${BASE}" || {
+	    [ -z "$quiet" ] &&   log_msg_fail "chmod -f -R 0700 ${BASE}"; 
 	    return 1;
 	}
