Index: trunk/test/test.sh
===================================================================
--- trunk/test/test.sh	(revision 591)
+++ trunk/test/test.sh	(revision 1)
@@ -1,244 +1,19 @@
 #! /bin/sh
 
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-# -----------------------------------------------------------------------
-# Be Bourne compatible
-# -----------------------------------------------------------------------
-
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-  set -o posix
-fi
-
-# -----------------------------------------------------------------------
-# Make sure we support functions (from the autoconf manual)
-# -----------------------------------------------------------------------
-
-TSHELL="${TSHELL-/bin/sh}"
-if test x"$1" = "x--re-executed" 
-then
-    shift
-elif "$TSHELL" -c 'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
-then
-    :
-else
-    for cmd in sh bash ash bsh ksh zsh sh5; do
-	X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb:/usr/xpg4/bin";
-	OLD_IFS=${IFS}
-	IFS=':'; export IFS 
-	for dir in $X; do
-	    shell="$dir/$cmd"
-	    if (test -f "$shell" || test -f "$shell.exe")
-	    then
-	        if "$shell" -c  'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
-		then
-		    TSHELL="$shell"; export TSHELL
-		    IFS=${OLD_IFS}; export IFS
-		    exec "$shell" "$0" --re-executed ${1+"$@"}
-		fi
-	    fi
-	done
-	IFS=${OLD_IFS}; export IFS
-    done
-    echo "-----------------------------------------------------------------"
-    echo "ERROR: Unable to locate a shell interpreter with function support" >&2
-    echo "-----------------------------------------------------------------"
-    { (exit 1); exit 1; }
-fi
-
-# -----------------------------------------------------------------------
-# Make sure we support 'let' (from the autoconf manual)
-# -----------------------------------------------------------------------
-
-TSHELL="${TSHELL-/bin/sh}"
-if test x"$1" = "x--re-run" 
-then
-    shift
-elif "$TSHELL" -c 'a=5; let "a = a + 5"' >/dev/null 2>&1
-then
-    :
-else
-    for cmd in sh bash ash bsh ksh zsh sh5; do
-	X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb:/usr/xpg4/bin";
-	OLD_IFS=${IFS}
-	IFS=':'; export IFS 
-	for dir in $X; do
-	    shell="$dir/$cmd"
-	    if (test -f "$shell" || test -f "$shell.exe")
-	    then
-	        if "$shell" -c  'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
-		then
-		    if "$shell" -c  'a=5; let "a = a + 5"' >/dev/null 2>&1
-		    then
-			TSHELL="$shell"; export TSHELL
-			IFS=${OLD_IFS}; export IFS
-			exec "$shell" "$0" --re-run ${1+"$@"}
-		    fi
-		fi
-	    fi
-	done
-	IFS=${OLD_IFS}; export IFS
-    done
-    echo "-----------------------------------------------------------------"
-    echo "ERROR: Unable to locate a shell interpreter with support for 'let'" >&2
-    echo "-----------------------------------------------------------------"
-    { (exit 1); exit 1; }
-fi
-
-
-umask 0022
-
-isok=`test -t 1 2>&1 | wc -c`
-if [ "$isok" -eq 0 ]; then
-   test -t 1
-   isok=$?
-fi
 
 # The following two are the ANSI sequences for start and end embolden
-if [ x"$isok" = x0 ]; then
-    case $TERM in
-	vt*|ansi*|con*|xterm*|linux*|screen*|rxvt*)
-	    S='[1;30m'
-	    R=[31m
-	    G=[32m
-	    B=[36m
-	    E=[m
-	    ;;
-	*)
-	    S=
-	    R=
-	    G=
-	    B=
-	    E=
-	    ;;
-    esac
-fi
-
-
-usage() {
-    echo "test.sh [options] <test_number> [hostname]"
-    echo "        [-q|--quiet|-v|--verbose] [-s|--stoponerr] [-n|--no-cleanup]"
-    echo "        [--srcdir=top_srcdir] [--color=always|never|auto]"
-    echo
-    echo "  ${S}test.sh  1${E}  -- Compile with many different options"
-    echo "  ${S}test.sh  2${E}  -- Hash function            (testrc_1)"
-    echo "  ${S}test.sh  3${E}  -- Standalone init/check"
-    echo "  ${S}test.sh  4${E}  -- Microstealth init/check"
-    echo "  ${S}test.sh  5${E}  -- External program call    (testrc_1ext.in)"
-    echo "  ${S}test.sh  6${E}  -- Controlling the daemon"
-    echo "  ${S}test.sh  7${E}  -- GnuPG signed files / prelude log"
-    echo "  ${S}test.sh  8${E}  -- Suidcheck"
-    echo "  ${S}test.sh  9${E}  -- Process check"
-    echo "  ${S}test.sh 10${E}  -- Port check"
-    echo "  ${S}test.sh 11${E}  -- CL verify option" 
-    echo "  ${S}test.sh 12${E}  -- CL create DeltaDB" 
-    echo "  ${S}test.sh 13${E}  -- CL create/verify partial DB" 
-    echo "  ${S}test.sh 14${E}  -- Signify signed files" 
-
-    echo "  ${S}test.sh 20${E}  -- Test c/s init/check      (testrc_2.in)"
-    echo "  ${S}test.sh 21${E}  -- Test full c/s init/check (testrc_2.in)"
-    echo "  ${S}test.sh 22${E}  -- Test full c/s w/gpg      (testrc_2.in)"
-    echo "  ${S}test.sh 23${E}  -- Test full c/s w/mysql    (testrc_2.in)"
-    echo "  ${S}test.sh 24${E}  -- Test full c/s w/postgres (testrc_2.in)"
-    echo "  ${S}test.sh 25${E}  -- Test server w/yulectl    (testrc_2.in)"
-    echo "  ${S}test.sh 26${E}  -- Test c/s case one        (testrc_2.in)"
-    echo "  ${S}test.sh 27${E}  -- Test c/s case two        (testrc_2.in)"
-    echo "  ${S}test.sh 28${E}  -- Test full c/s w/signify  (testrc_2.in)"
-    echo "  ${S}test.sh all${E} -- All tests"
-}
-scripts () {
-    echo 
-    echo "Scripts used by tests:"
-    echo "  (1) testcompile.sh (2) testhash.sh     (3) testrun_1.sh   (4) testrun_1a.sh"
-    echo "  (5) testext.sh     (6) testtimesrv.sh  (7) testrun_1b.sh  (8) testrun_1c.sh" 
-    echo "  (9) testrun_1d.sh (10) testrun_1e.sh  (11) testrun_1f.sh (12) testrun_1g.sh" 
-    echo " (13) testrun_1h.sh (14) testrun_1i.sh"
-    echo " (20) testrun_2.sh  (21) testrun_2a.sh  (22) testrun_2b.sh (23) testrun_2c.sh"
-    echo " (24) testrun_2d.sh (25) testrun_2e.sh  (26) testrun_2f.sh (27) testrun_2g.sh"
-    echo " (28) testrun_2h.sh"
-    }
-
-#
-# Option parsing
-#
-verbose=
-quiet=
-stoponerr=
-color=auto
-cleanup=on
-doall=
-usevalgrind=
-
-while [ $# -gt 0 ]
-do
-    case "$1" in
-        -h|--help)     usage; exit 0;;
-	--scripts)     usage; scripts; exit 0;;
-        -v|--verbose)  verbose=on; quiet= ;;
-        -q|--quiet)    quiet=on; verbose= ;;
-        -s|--stoponerr)     stoponerr=on;;
-	-n|--no-cleanup) cleanup= ;;
-	--really-all) doall=on;;
-	--valgrind) usevalgrind=on;;
-	--srcdir=*)    TOP_SRCDIR=`echo $1 | sed s,--srcdir=,,`; export TOP_SRCDIR;;
-	--color=*)     
-	    arg=`echo $1 | sed s,--color=,,`
-	    case $arg in
-		auto) ;;
-		never|none|no) 
-		    S=
-		    R=
-		    G=
-		    B=
-		    E=
-		    ;;
-		always|yes)
-		    S='[1;30m'
-		    R=[31m
-		    G=[32m
-		    G=[36m
-		    E=[m
-		    ;;
-		*) echo "Invalid argument $1"; exit 1;;
-	    esac
-	    ;;
-        -*)  echo "Invalid argument $1"; exit 1;;
-	*) break;;
-    esac
-    shift
-done
-
-export verbose
-export quiet
-export stoponerr
-export cleanup
-export doall
-export S; export R; export G; export B; export E;
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
 
 SCRIPTDIR=.
 
-#
-# 'make test' will copy the 'test' subdirectory and replace TEST_SRCDIR
-#
 TEST_SRCDIR="XXXSRCXXX";
 if test "x${TOP_SRCDIR}" = x; then
@@ -266,5 +41,5 @@
 	    export TOP_SRCDIR
 	else
-	    echo "Please use --srcdir=DIR, where DIR should be the"
+	    echo "Please set the environment variable TOP_SRCDIR to the"
 	    echo "top directory in the samhain source tree."
 	    exit 1
@@ -272,13 +47,15 @@
     fi
 else
-    # called by make, or with --srcdir=TOP_SRCDIR
-    if   test -f "${TOP_SRCDIR}/src/samhain.c"; then
-	SCRIPTDIR="${TOP_SRCDIR}/test"
-    elif test -f "../${TOP_SRCDIR}/src/samhain.c"; then
-	cd ..; SCRIPTDIR="${TOP_SRCDIR}/test"
+    # called by make
+    if test -f "${TOP_SRCDIR}/src/samhain.c"; then
+	SCRIPTDIR=test
     else
-	echo "Please use --srcdir=DIR, where DIR should be the"
-	echo "top directory in the samhain source tree."
-	exit 1
+	if test -f "../${TOP_SRCDIR}/src/samhain.c"; then
+	    cd ..; SCRIPTDIR=test
+	else
+	    echo "Please set the environment variable TOP_SRCDIR to the"
+	    echo "top directory in the samhain source tree."
+	    exit 1
+	fi
     fi
 fi
@@ -288,639 +65,75 @@
 PW_DIR=`pwd`; export PW_DIR
 
-#
-# group/world writeable will cause problems
-#
-chmod go-w .
+if test x$1 = x1; then
+    exec ${SCRIPTDIR}/testcompile.sh
+fi
+if test x$1 = x2; then
+    exec ${SCRIPTDIR}/testhash.sh
+fi
+if test x$1 = x3; then
+    exec ${SCRIPTDIR}/testrun_1.sh
+fi
+if test x$1 = x4; then
+    exec ${SCRIPTDIR}/testrun_1a.sh
+fi
+if test x$1 = x5; then
+    exec ${SCRIPTDIR}/testext.sh
+fi
+if test x$1 = x6; then
+    exec ${SCRIPTDIR}/testtimesrv.sh
+fi
+if test x$1 = x7; then
+    exec ${SCRIPTDIR}/testrun_1b.sh
+fi
+if test x$1 = x10; then
+    exec ${SCRIPTDIR}/testrun_2.sh $2
+fi
+if test x$1 = x11; then
+    exec ${SCRIPTDIR}/testrun_2a.sh $2
+fi
+if test x$1 = x12; then
+    exec ${SCRIPTDIR}/testrun_2b.sh $2
+fi
+if test x$1 = x13; then
+    exec ${SCRIPTDIR}/testrun_2c.sh $2
+fi
+if test x$1 = x14; then
+    exec ${SCRIPTDIR}/testrun_2d.sh $2
+fi
+if test x$1 = xall; then
+    ${SCRIPTDIR}/testcompile.sh
+    ${SCRIPTDIR}/testhash.sh
+    ${SCRIPTDIR}/testrun_1.sh
+    ${SCRIPTDIR}/testrun_1a.sh
+    ${SCRIPTDIR}/testext.sh
+    ${SCRIPTDIR}/testtimesrv.sh
+    ${SCRIPTDIR}/testrun_1b.sh
+    ${SCRIPTDIR}/testrun_2.sh $2
+    ${SCRIPTDIR}/testrun_2a.sh $2
+fi
+
+echo "Usage (in brackets: config files used):"
+echo
+echo "  ${S}test.sh 1${E}            -- Compilation with many different options"
+echo "  ${S}test.sh 2${E}            -- Hash function"
+echo "  ${S}test.sh 3${E}            -- Standalone init/check    (testrc_1)"
+echo "  ${S}test.sh 4${E}            -- Microstealth init/check  (testrc_1)"
+echo "  ${S}test.sh 5${E}            -- External program call    (testrc_1ext.in)"
+echo "  ${S}test.sh 6${E}            -- Timeserver option        (testrc_1)"
+echo "  ${S}test.sh 7${E}            -- GnuPG signed files       (testrc_1)"
 #
 #
 #
-if test x$UID != x -a x$UID != x0; then
-  TRUST="--with-trusted=0,2,$UID"
-else
-  TRUST="--with-trusted=0,2,1000"
-fi
-export TRUST
-#
-# find a good 'make'
-#
-MAKE=`which gmake`
-if test "x$?" = x1 ; then
-    MAKE="make -s -j 3"
-else
-    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
-    if test "x$MAKE" = x; then
-	MAKE="make -s"
-    elif test "x$MAKE" = xno; then
-	MAKE="make -s"
-    else
-	if test "x$MAKE" = "xwhich:"; then
-		MAKE="make -s"
-	else
-		MAKE="gmake -s"
-		gmake -v >/dev/null 2>&1 || MAKE="make -s"
-	fi
-    fi
-fi
-export MAKE
+echo "  ${S}test.sh 10 hostname${E}  -- Test c/s init/check      (testrc_2.in)"
+echo "  ${S}test.sh 11 hostname${E}  -- Test full c/s init/check (testrc_2.in)"
+echo "  ${S}test.sh 12 hostname${E}  -- Test full c/s w/gpg      (testrc_2.in)"
+echo "  ${S}test.sh 13 hostname${E}  -- Test full c/s w/mysql    (testrc_2.in)"
+echo "  ${S}test.sh 14 hostname${E}  -- Test c/s w/syslog logging(testrc_2.in)"
+echo "  ${S}test.sh a  hostname${E}  -- All except 7,12+"
 
-failcount=0
-okcount=0
-skipcount=0
-global_count=0
-last_count=0
+echo 
+echo "Scripts used: (1) ./testcompile.sh  (2) ./testhash.sh    (3) ./testrun_1.sh"
+echo "              (4) ./testrun_1a.sh   (5) ./testext.sh     (6) ./testtimesrv.sh"
+echo "              (7) ./testrun_1b.sh  (10) ./testrun_2.sh  (11) ./testrun_2a.sh"
+echo "             (12) ./testrun_2b.sh  (13) ./testrun_2c.sh (14) ./testrun_2d.sh"
 
-# args: #test, #total, status, optional msg
-log_msg ()
-{
-    if   [ x"$COLUMNS" != x ]; then
-	TERMWIDTH=$COLUMNS
-    elif [ x"$COLS" != x ]; then
-	TERMWIDTH=$COLS
-    else
-	TERMWIDTH=80
-    fi
-    cols=66; 
-    #
-    if [ $1 -eq 0 ]; then
-	msg=" ${4}"
-    else
-	if [ ${1} -eq 1 ]; then
-	    global_count=${last_count}
-	fi
-	let "v = $1 + global_count" >/dev/null
-	last_count=${v}
-	dd=''; if [ $v -lt 10 ]; then dd=" "; fi
-	dt=''; if [ $2 -lt 10 ]; then dt=" "; fi
-	if [ -z "$4" ]; then
-	    msg=" test ${dd}${v}/${dt}${2}"
-	else
-	    msg=" test ${dd}${v}/${dt}${2}    ${4}"
-	fi
-    fi
-    #
-    if   [ x"$3" = xfailure ]; then
-	ccode=$R
-    elif [ x"$3" = xsuccess ]; then
-	ccode=$G
-    else
-	ccode=$B
-    fi
-    if [ -z "${R}" ]; then
-	echo " [${3}] ${msg}"
-    else
-	# len=${#...} is not bourne shell
-	# also, need to account for terminal control sequences
-	len=`echo "$msg" | awk '/1;30m/ { print length()-10; }; !/1;30m/ { print length();}'`
-	let "cols = cols - len" >/dev/null
-	if [ $cols -ge 0 ]; then
-	    moveto='['$cols'C'
-	    echo "${msg}${moveto}${ccode}[${3}]${E}"
-	else
-	    echo "${msg}${ccode}[${3}]${E}"
-	fi
-    fi
-}
-
-log_fail () { 
-    [ -z "$quiet" ] && log_msg "$1" "$2" failure "$3"; 
-    let "failcount = failcount + 1" >/dev/null; 
-    test -z "$stoponerr" || exit 1; 
-}
-log_ok ()   { 
-    [ -z "$quiet" ] && log_msg "$1" "$2" success "$3"; 
-    let "okcount = okcount + 1" >/dev/null; 
-}
-log_skip () { 
-    [ -z "$quiet" ] && log_msg "$1" "$2" skipped "$3"; 
-    let "skipcount = skipcount + 1" >/dev/null; 
-}
-
-log_msg_fail () { log_msg 0 0 failure "$1"; }
-log_msg_ok ()   { log_msg 0 0 success "$1"; }
-log_msg_skip () { log_msg 0 0 skipped "$1"; }
-
-log_start () {
-    if [ -z "$quiet" ]; then
-	echo; 
-	echo "${S}__ START TEST ${1} __${E}"; 
-	echo; 
-    fi
-}
-log_end () {
-    if [ -n "$verbose" ]; then
-	echo; 
-	echo "${S}__ END   TEST ${1} __${E}"; 
-	echo; 
-    fi
-}
-
-# This looks silly, but with solaris10/i386 on vmware,
-# 'sleep' occasionally does not sleep...
-
-one_sec_sleep () {
-    onesdate=`date`
-    onestest=0
-    while [ $onestest -eq 0 ]; do
-	sleep 1
-	twosdate=`date`
-	if [ "x$twosdate" = "x$onesdate" ]; then 
-	    onestest=0
-	else
-	    onestest=1
-	fi
-    done
-}
-
-five_sec_sleep () {
-    for f in 1 2 3 4 5; do
-	one_sec_sleep
-    done
-}
-
-do_cleanup () {
-    rm -f testrc_1.dyn
-    rm -f testrc_2
-    rm -f testrc_22
-    rm -f testrc_1ext
-    rm -f ./.samhain_file
-    rm -f file.*.*-*-*-*-*
-    rm -f ./.samhain_log*
-    rm -f ./.samhain_lock*
-    test -d testrun_testdata && chmod -f -R 0700 testrun_testdata
-    test -d .quarantine && rm -rf .quarantine
-    rm -rf testrun_testdata
-    rm -f test_log_db
-    rm -f test_log_prelude
-    rm -f test_log_valgrind*
-    rm -f test_log_yulectl
-    rm -f yule.html
-    rm -f yule.html2
-    rm -f test_dnmalloc
-    rm -f tmp_list_file
-    rm -f test_filter.txt
-}
-
-print_summary ()
-{
-    # let "gcount = okcount + skipcount + failcount" >/dev/null;
-    gcount=$MAXTEST;
-    let "failcount = gcount - okcount - skipcount" >/dev/null;
-
-    [ -z "$quiet" ] && { 
-	echo
-	echo "__ ${S}Tests: ${gcount}  Ok: ${okcount} Skipped: ${skipcount} Failed: ${failcount}${E}"
-    }
-    if [ $failcount -eq 0 ]; then
-	[ -z "$quiet" ] && { echo "__ ${G}All tests passed successfully.${E}"; echo; }
-    elif [ $failcount -eq 1 ]; then
-	[ -z "$quiet" ] && { echo "__ ${R}There was 1 failure.${E}"; echo; }
-    else
-	[ -z "$quiet" ] && { echo "__ ${R}There were $failcount failures.${E}"; echo; }
-    fi
-    [ -z "$cleanup" ] || do_cleanup;
-}
-
-find_path () { (   
-    save_IFS=$IFS; IFS=:
-
-    for dir in $PATH; do
-	IFS=$as_save_IFS
-	test -z "$dir" && dir=.
-	if test -f "$dir/$1"; then
-	    echo "$dir/$1";
-	    break;
-	fi
-    done
-    IFS=${save_IFS};
-); }
-
-find_hostname () {
-
-    uname -a | grep Linux >/dev/null
-    if [ $? -eq 0 ]; then
-	tmp=`hostname -f 2>/dev/null`
-	if [ $? -ne 0 ]; then
-	    tmp=`hostname 2>/dev/null`
-	fi
-    else
-	tmp=`hostname 2>/dev/null`
-    fi
-    if [ -z "$tmp" ]; then
-	tmp="localhost"
-    fi
-    #
-    # first one is hostname, others are aliases
-    #
-    tmp2=`cat /etc/hosts | egrep "^ *[0123456789].* $tmp" | awk '{ print $2 }'`
-    if [ -z "$tmp2" ]; then
-	echo "$tmp"
-    else
-	echo "$tmp2"
-    fi
-}
-
-rm -f ./test_log
-
-# first one is hostname, others are aliases
-#
-hostname=`cat /etc/hosts | egrep "^ *127.0.0.1" | awk '{ print $2 }'`
-if [ x"$hostname" = xlocalhost ]; then
-    hostname="127.0.0.1"
-fi
-
-# Seems that 'valgrind' causes random hangs :-(
-#
-if [ -z "$usevalgrind" ]; then
-    VALGRIND=
-else
-    VALGRIND=`find_path valgrind`;
-fi
-[ -z "$VALGRIND" ] || { 
-    VALGRIND="$VALGRIND --quiet --tool=memcheck --suppressions=.test.supp"; 
-    export VALGRIND;
-    [ -z "$verbose" ] || log_msg_ok "using valgrind"
-cat > ".test.supp" <<End-of-data
-#
-# there are unitialized bytes in the struct...
-#
-{
-   pushdata_01
-   Memcheck:Param
-   write(buf)
-   obj:/lib/ld-*.so
-   fun:sh_hash_pushdata
-   fun:sh_files_filecheck
-   fun:sh_dirs_chk
-}
-{
-   pushdata_02
-   Memcheck:Param
-   write(buf)
-   obj:/lib/ld-*.so
-   fun:sh_hash_pushdata
-   fun:sh_files_filecheck
-   fun:sh_files_checkdir
-}
-{
-   pushdata_03
-   Memcheck:Param
-   write(buf)
-   obj:/lib/ld-*.so
-   fun:sh_hash_pushdata
-   fun:sh_hash_writeout
-   fun:main
-}
-
-End-of-data
-}
-
-if test x$1 = x1; then
-    . ${SCRIPTDIR}/testcompile.sh
-    testcompile
-    print_summary
-    exit $?
-fi
-if test x$1 = x2; then
-    . ${SCRIPTDIR}/testhash.sh
-    testhash
-    print_summary
-    exit $?
-fi
-if test x$1 = x3; then
-    . ${SCRIPTDIR}/testrun_1.sh
-    testrun1
-    print_summary
-    exit $?
-fi
-if test x$1 = x4; then
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1a.sh
-    testrun1a
-    print_summary
-    exit $?
-fi
-if test x$1 = x5; then
-    . ${SCRIPTDIR}/testext.sh
-    testext0
-    print_summary
-    exit $?
-fi
-if test x$1 = x6; then
-    . ${SCRIPTDIR}/testtimesrv.sh
-    testtime0
-    print_summary
-    exit $?
-fi
-if test x$1 = x7; then
-    . ${SCRIPTDIR}/testrun_1b.sh
-    testrun1b
-    print_summary
-    exit $?
-fi
-if test x$1 = x8; then
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1c.sh
-    testrun1c
-    print_summary
-    exit $?
-fi
-if test x$1 = x9; then
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1d.sh
-    testrun1d
-    print_summary
-    exit $?
-fi
-if test x$1 = x10; then
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1e.sh
-    testrun1e
-    print_summary
-    exit $?
-fi
-if test x$1 = x11; then
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1f.sh
-    testrun1f
-    print_summary
-    exit $?
-fi
-if test x$1 = x12; then
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1g.sh
-    testrun1g
-    print_summary
-    exit $?
-fi
-if test x$1 = x13; then
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1h.sh
-    testrun1h
-    print_summary
-    exit $?
-fi
-if test x$1 = x14; then
-    . ${SCRIPTDIR}/testrun_1i.sh
-    testrun1i
-    print_summary
-    exit $?
-fi
-if test x$1 = x20; then
-    . ${SCRIPTDIR}/testrun_2.sh 
-    testrun2 $hostname
-    print_summary
-    exit $?
-fi
-if test x$1 = x21; then
-    . ${SCRIPTDIR}/testrun_2a.sh
-    testrun2a $hostname
-    print_summary
-    exit $?
-fi
-if test x$1 = x22; then
-    . ${SCRIPTDIR}/testrun_2a.sh
-    . ${SCRIPTDIR}/testrun_2b.sh
-    testrun2b $hostname
-    print_summary
-    exit $?
-fi
-if test x$1 = x23; then
-    . ${SCRIPTDIR}/testrun_2a.sh
-    . ${SCRIPTDIR}/testrun_2c.sh 
-    testrun2c $hostname
-    print_summary
-    exit $?
-fi
-if test x$1 = x24; then
-    . ${SCRIPTDIR}/testrun_2a.sh
-    . ${SCRIPTDIR}/testrun_2d.sh
-    testrun2d $hostname
-    print_summary
-    exit $?
-fi
-if test x$1 = x25; then
-    . ${SCRIPTDIR}/testrun_2e.sh
-    testrun2e $hostname
-    print_summary
-    exit $?
-fi
-if test x$1 = x26; then
-    . ${SCRIPTDIR}/testrun_2f.sh
-    testrun2f $hostname
-    print_summary
-    exit $?
-fi
-if test x$1 = x27; then
-    . ${SCRIPTDIR}/testrun_2g.sh
-    testrun2g $hostname
-    print_summary
-    exit $?
-fi
-if test x$1 = x28; then
-    . ${SCRIPTDIR}/testrun_2a.sh
-    . ${SCRIPTDIR}/testrun_2h.sh
-    testrun2h $hostname
-    print_summary
-    exit $?
-fi
-if test x$1 = xall; then
-    TEST_MAX=0
-    . ${SCRIPTDIR}/testcompile.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testhash.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_1.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_1a.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testext.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testtimesrv.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_1b.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_1c.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_1d.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_1e.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_1f.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_1g.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_1h.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_1i.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_2.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_2a.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_2b.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_2c.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_2d.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_2e.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_2f.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_2g.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    . ${SCRIPTDIR}/testrun_2h.sh
-    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
-    #
-    # ${SCRIPTDIR}/testtimesrv.sh
-    # ${SCRIPTDIR}/testrun_1b.sh
-    # ${SCRIPTDIR}/testrun_2.sh $2
-    # ${SCRIPTDIR}/testrun_2a.sh $2
-    #
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testcompile
-    testhash
-    #
-    . ${SCRIPTDIR}/testrun_1.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun1
-    #
-    . ${SCRIPTDIR}/testrun_1a.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun1a
-    #
-    testext0
-    #
-    . ${SCRIPTDIR}/testtimesrv.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testtime0
-    #
-    . ${SCRIPTDIR}/testrun_1b.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun1b
-    #
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1c.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun1c
-    #
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1d.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun1d
-    #
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1e.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun1e
-    #
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1f.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun1f
-    #
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1g.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun1g
-    #
-    . ${SCRIPTDIR}/testrun_1.sh
-    . ${SCRIPTDIR}/testrun_1h.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun1h
-    #
-    . ${SCRIPTDIR}/testrun_1i.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun1i
-    #
-    . ${SCRIPTDIR}/testrun_2.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun2 $hostname
-    #
-    . ${SCRIPTDIR}/testrun_2a.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun2a $hostname
-    #
-    . ${SCRIPTDIR}/testrun_2b.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun2b $hostname
-    #
-    . ${SCRIPTDIR}/testrun_2c.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun2c $hostname
-    #
-    . ${SCRIPTDIR}/testrun_2d.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun2d $hostname
-    #
-    . ${SCRIPTDIR}/testrun_2e.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun2e $hostname
-    #
-    . ${SCRIPTDIR}/testrun_2f.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun2f $hostname
-    #
-    . ${SCRIPTDIR}/testrun_2g.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun2g $hostname
-    #
-    . ${SCRIPTDIR}/testrun_2h.sh
-    MAXTEST=${TEST_MAX}; export MAXTEST
-    testrun2h $hostname
-    #
-    print_summary
-    exit 0
-fi
-
-usage;
-
-exit 1;
-
-# gpg -a --clearsign --not-dash-escaped testrc.gpg
-# gpg -a --clearsign --not-dash-escaped .samhain_file
-# tar czvf foo.tgz testrc.gpg.asc .samhain_file.asc
-# cat foo.tgz >>test/test.sh
-
-__ARCHIVE_FOLLOWS__
- p{U í=lÛFÇé©Å!sÑ-diD&%r
-#QŽÖ
-ÙQ0ÒbÍ€d+KÐµk¢@75kå¡l}!KaDÔ:µC=öÐÕ
-¥ØRA
-8MûÄñþw÷îœ»ã;Ùñ(Å#ÛêR 1ìÜ[2?=^º0þ@bŒ~ËÒ^ÆÇR4ãcXôåž3IÑvd
-BÊUY¯î÷ºöÿ)7]n
-bD11QBpIH&yQ6EÙÎ/Àä"Ï ÉtBž&Ø¹²
-pÍ,B¡,bL	KÈRseèäUêÈ¶e 6xÇ±Ô{EÙ §jENkÐ0
-h!YÓÊP3·ÉŸqG(kºi;P)Êl8î
-Ø:ÚQml¹­JÔTÂî1³6²JjÙcR
-Û¯ëŠÅ.	%d8Iä:ì7ÁÙ×
-¶@sü9!1RÉÙeC+OªgMªÞŸÔQ
-ÓBi Iýb±Šõç5Û-ã\
-MÇ}.TËæT#g+÷c4l`g6Á¬jg­xŒ Ï
-Ñ
-e[Óbz±p£9ÀÆjg6AHFºiànxVÇõ+G­ª#ñÒ®@¢e«ŠÅ4QÓ,
-;±4H i9á¢Š
-
-
-># èÚ±z
-§+nhÔÝÁåð& SN0ZIŒ8Œ«h8ÛÂZb<^~$J+³QÕ(î|
-Ý
-ëvzYüÖËü­ô¢w;ÁÖü§tÂ|:}OºãÒŽ^_âJÅto	,ÑR"ž÷(
-€ £«|#
-àr"zè 
-Š¹÷_ÿþÇõ<Nm¹ÿÇ%]ÃüÏŸ:ÿ³¬ÿ,ÿ3vó?KûIþŒüÿëo?õc¢
-`Þ{Òïñ;C]ÁeTÿª^^qËçNãTÆpëPÃÃÓÆ7]=
-<ûkPqjï
-Á£?Ô/O
-PÔÃ£Ó§à&š|9=¬üþðÉêÆÌš
-üöþ0k!ÏDù/ÂúqªúMeð¬2šžÕît·[ýÝf³ßkµúµn£Õì4v[ûÝ~³ÛÚoWö:m¬7÷z­Z
-¿zõ"¬
-Œ&žñå¢£úw_Snùhÿ8uiÁõ«ûµN£±Ûk÷;j»ßÝ¯ï
-tkœfµW­7v»Õ^§^ëvêõÇ»œNïåàNÏzäÆ÷·Ÿ-5OA_
-óÚj¿çÊVüâæ(¯ ¢Éó$Ûï®¢ì
-»
-ž^HM
-øb[Œy'ñ
-ëhIæŒëw5o2
-ÒÐb!f|81œ|·o
-@ @ @ ð.ò7<Ì (  
Index: trunk/test/test1i_samhain.pub
===================================================================
--- trunk/test/test1i_samhain.pub	(revision 591)
+++ 	(revision )
@@ -1,2 +1,0 @@
-untrusted comment: signify public key
-RWRGHbBcvfnUvBA0DUrvkt5OIZzdOgD0X8mTn6wKd4UNOHp8mVL2pCKP
Index: trunk/test/testcompile.sh
===================================================================
--- trunk/test/testcompile.sh	(revision 591)
+++ trunk/test/testcompile.sh	(revision 1)
@@ -1,284 +1,74 @@
 #! /bin/sh
 
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-# dnmalloc + cppcheck + flawfinder + (38 * 2) - 8
-MAXTEST=79; export MAXTEST
-
-run_dnmalloc ()
-{
-    uname -a | grep -i openbsd >/dev/null
-    if test x$? = x0; then
-	log_skip $num ${MAXTEST} 'test dnmalloc'
-	return 0
+
+# The following two are the ANSI sequences for start and end embolden
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
+
+PW_DIR=`pwd`
+
+if test x$UID != x; then
+  TRUST="--with-trusted=0,2,$UID"
+else
+  TRUST="--with-trusted=0,2"
+fi
+
+#echo; echo "${S}__ STARTING TEST COMPILE __${E}"; echo;
+#echo Working directory: $PW_DIR
+
+MAKE=`which gmake`
+if test "x$?" = x1 ; then
+    MAKE="make -s"
+else
+    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$MAKE" = x; then
+	MAKE="make -s"
+    elif test "x$MAKE" = xno; then
+	MAKE="make -s"
+    else
+	if test "x$MAKE" = "xwhich:"; then
+		MAKE="make -s"
+	else
+		MAKE="gmake -s"
+		gmake -v >/dev/null 2>&1 || MAKE="make -s"
+	fi
     fi
-    uname -a | grep -i darwin >/dev/null
-    if test x$? = x0; then
-	log_skip $num ${MAXTEST} 'test dnmalloc'
-	return 0
-    fi
-
-    fail=0
-    if test x$1 = x0; then
-	[ -z "$verbose" ]     ||  log_msg_ok  "configure...";
-	$MAKE clean > /dev/null 2>> test_log
-	$MAKE test_dnmalloc > /dev/null 2>> test_log
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok   "make test_dnmalloc...";
- 	else
-	    [ -z "$quiet" ] &&   log_msg_fail "make test_dnmalloc...";
-	    fail=1
-	fi
-    else
-	[ -z "$quiet" ] &&       log_msg_fail "configure...";
-	if [ x"$3" = xskip ]; then
-	    [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "test dnmalloc";
-	fi
-	fail=1
-    fi
-    if [ $fail -eq 1 ]; then
-	[ -z "$quiet" ] && log_fail $2 ${MAXTEST} "test dnmalloc";
-	return 1
-    fi
-    #
-    fail=0
-    ./test_dnmalloc >/dev/null
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok   "run 1 completed...";
-	./test_dnmalloc 300 12 3000 150000 400 >/dev/null
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok   "run 2 completed...";
-	    ./test_dnmalloc 1 1 4000 10000000 1000 >/dev/null
-	    if test x$? = x0; then
-		[ -z "$verbose" ] || log_msg_ok   "run 3 completed...";
-		./test_dnmalloc 1 1 4000 10000000 1000 >/dev/null
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok   "run 4 completed...";
-		else
-		    fail=1
-		fi
-	    else
-		fail=1
-	    fi
-	else
-	    fail=1
-	fi
-    else
-	fail=1
-    fi
-    #
-    if test x$fail = x0; then
-	[ -z "$quiet" ] &&     log_ok   $2 ${MAXTEST} "test dnmalloc";
-	return 0
-    else
-	[ -z "$quiet" ] && log_fail $2 ${MAXTEST} "test dnmalloc";
-	return 1
-    fi
-}
-
-run_cppcheck ()
-{
-    #
-    CPC=`find_path cppcheck`
-    #
-    if [ -z "$CPC" ]; then
-	log_skip $num ${MAXTEST} 'check w/cppcheck (not in PATH)'
-	return 0
-    fi
-    #
-    cd src/
-    stat=`cppcheck --quiet --library=posix.cfg --inline-suppr --force -j 4 --template="{file},{line},{severity},{id},{message}" -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 0 ]; then
-	cppcheck --quiet --library=posix.cfg --inline-suppr --force -j 4 --template="{file},{line},{severity},{id},{message}" -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} "check w/cppcheck";
-    else
-	retval=0
-	[ -z "$quiet" ] &&     log_ok   $2 ${MAXTEST} "check w/cppcheck";
-    fi
-    cd ..
-    return $retval
-}
-
-run_flawfinder ()
-{
-    flawfinder --minlevel=3 --quiet src/s*.c | \
-	egrep '^No hits found.' >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	[ -z "$quiet" ] &&     log_ok   $2 ${MAXTEST} "$TEST";
-    else
-	flawfinder --minlevel=3 --quiet src/s*.c >test_log 2>&1
-	[ -z "$quiet" ] && log_fail $2 ${MAXTEST} "$TEST";
-	return 1
-    fi
-}
-
-run_clang () 
-{
-    export CDIR=`pwd`;
-
-    if [ -z "$doall" ]; then
-	[ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (clang)";
-	return 0
-    fi
-
-    CLANGPATH=`find_path clang`
-    if [ -n "$CLANGPATH" ]; then
-	CLANG_CC="$CLANGPATH"; export CLANG_CC
-    else
-	[ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (clang)";
-	return 0
-    fi
-
-    SAVE_TEST="$TEST"
-    TEST="$TEST (clang)"
-    testmake $1 $2
-    retval=$?
-    CLANG_CC=""; export CLANG_CC
-    TEST="$SAVE_TEST"
-    return $retval
-}
+fi
+
+#echo MAKE is $MAKE
+#echo
 
 testmake ()
 {
-	fail=0
-	#
-	# Compiler warnings can be OS specific, but at least
-	# on Linux there should be none
-	#
-	isLinux=0
-	uname -a | grep Linux >/dev/null
-	if [ $? -eq 0 ]; then
-	    isLinux=1
-	    sed --in-place 's/-Wall/-Wall -Werror -Wpointer-arith -Wcast-qual/' Makefile
-	fi
-	#
+
 	if test x$1 = x0; then
-		[ -z "$verbose" ]     ||  log_msg_ok  "configure...  $TEST";
-		$MAKE clean > /dev/null 2>> test_log
-		if [ -z "$CLANG_CC" ]; then
-		    $MAKE cutest > /dev/null 2>> test_log
-		else
-		    sed --in-place 's/-Wno-empty-body/-Wno-empty-body -Wno-invalid-source-encoding/g' Makefile
-		    sed --in-place 's/-fno-strength-reduce//g' Makefile
-		    sed --in-place 's/-fstack-clash-protection//g' Makefile
-		    $MAKE -e CC=$CLANG_CC -e BUILD_CC=$CLANG_CC cutest > /dev/null 2>> test_log
-		fi
+		echo "PASS: configure ${TEST}"; 
+		$MAKE  > /dev/null 2>> test_log
 		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok   "make cutest... $TEST";
+		    echo "PASS: $MAKE  ${TEST}";
  		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make cutest... $TEST";
-		    fail=1
+		    echo "FAIL: $MAKE  ${TEST} (see ./test_log)";
 		fi
 	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...   $TEST";
-	        if [ x"$3" = xskip ]; then
-		    [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST";
-		fi
-		fail=1
-	fi
-	if [ $isLinux -eq 1 ]; then
-	    sed --in-place 's/-Wall -Werror/-Wall/' Makefile
-	fi
-	if [ $fail -eq 1 ]; then
-	    [ -z "$quiet" ] && log_fail $2 ${MAXTEST} "$TEST";
-	    return 1
-	fi
-	[ -z "$quiet" ] &&     log_ok   $2 ${MAXTEST} "$TEST";
-	return 0
+		echo "FAIL: configure  ${TEST} (see ./test_log)"; 
+	fi
 }
 
 testcompile ()
 {
-	log_start "COMPILE"
-
-	num=0
-	numfail=0
-
-	
-	C_LOGFILE=""
-
-	ls /lib/libpcre* >/dev/null 2>&1
-	if [ $? -eq 0 ]; then
-	    C_LOGFILE=" --enable-logfile-monitor "
-	else
-	    ls /usr/lib/libpcre* >/dev/null 2>&1
-	    if [ $? -eq 0 ]; then
-		C_LOGFILE=" --enable-logfile-monitor "
-	    else
-		ls /usr/lib/*/libpcre* >/dev/null 2>&1
-		if [ $? -eq 0 ]; then
-		    C_LOGFILE=" --enable-logfile-monitor "
-		else
-		    ls /usr/local/lib/libpcre* >/dev/null 2>&1
-		    if [ $? -eq 0 ]; then
-			C_LOGFILE=" --enable-logfile-monitor "
-		    fi
-		fi
-	    fi
-	fi
-	if [ x"${C_LOGFILE}" = x ]; then
-	    log_msg_ok  "Not testing  --enable-logfile-monitor";
-	fi
-
-	#
-	# test dnmalloc
-	#
-        TEST="${S}check dnmalloc${E}"
-	#
-	${TOP_SRCDIR}/configure --quiet > /dev/null 2>> test_log
-	#
-	let "num = num + 1" >/dev/null
-	#
-	run_dnmalloc 0 $num || let "numfail = numfail + 1"  >/dev/null
-	#
-
-	#
-	# test dnmalloc
-	#
-        TEST="${S}check w/cppcheck${E}"
-	#
-	let "num = num + 1" >/dev/null
-	#
-	run_cppcheck 0 $num || let "numfail = numfail + 1"  >/dev/null
-	#
-
-	#
-	# test flawfinder
-	#
-        TEST="${S}check w/flawfinder${E}"
-	#
-	#
-	let "num = num + 1" >/dev/null
-	FLAWFINDER=`find_path flawfinder`
-	#
-	if [ -z "$FLAWFINDER" ]; then
-	    log_skip $num $MAXTEST 'check w/flawfinder (not in PATH)'
-	else
-	    run_flawfinder 0 $num || let "numfail = numfail + 1"  >/dev/null
-	fi
-	#
-
-	#
-	# test standalone compilation
-	#
-        TEST="${S}standalone w/suidcheck w/procchk${E}"
+	rm -f ./test_log
+
+	#
+	# test standalone compilation
+	#
+        TEST="${S}standalone agent w/suidcheck${E}"
 	#
 	if test -r "Makefile"; then
@@ -286,15 +76,12 @@
 	fi
 	#
-	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  --enable-suidcheck --enable-process-check > /dev/null 2>> test_log
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1"  >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test standalone compilation
-	#
-        TEST="${S}standalone static w/suidcheck w/procchk${E}"
+	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  --enable-suidcheck > /dev/null 2>> test_log
+	#
+	testmake $?
+
+	#
+	# test standalone compilation
+	#
+        TEST="${S}standalone agent w/mounts-check and w/userfiles${E}"
 	#
 	if test -r "Makefile"; then
@@ -302,78 +89,13 @@
 	fi
 	#
-	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  --enable-static --enable-suidcheck --enable-process-check ${C_LOGFILE} > /dev/null 2>> test_log
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1"  >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	#
-	# test standalone compilation
-	#
-        TEST="${S}standalone w/procchk w/portchk${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE distclean 
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  --enable-process-check --enable-port-check > /dev/null 2>> test_log
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1"  >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test standalone compilation
-	#
-        TEST="${S}standalone w/procchk w/portchk w/static${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE distclean 
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  --enable-process-check --enable-port-check --enable-static > /dev/null 2>> test_log
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1"  >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	#
-	# test standalone compilation
-	#
-        TEST="${S}standalone w/procchk w/portchk w/stealth${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE distclean 
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  --enable-stealth=164 --enable-process-check --enable-port-check > /dev/null 2>> test_log
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1"  >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test standalone compilation
-	#
-        TEST="${S}standalone w/mounts-check w/userfiles${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE distclean 
-	fi
-	#
 	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  --enable-mounts-check --enable-userfiles  > /dev/null 2>> test_log
 	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-
-	#
-	# test standalone compilation
-	#
-        TEST="${S}standalone w/timeserver and w/msgqueue${E}"
+	testmake $?
+
+
+	#
+	# test standalone compilation
+	#
+        TEST="${S}standalone agent w/timeserver and w/message-queue${E}"
 	#
 	if test -r "Makefile"; then
@@ -383,29 +105,23 @@
 	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  --enable-message-queue --with-timeserver=127.0.0.1 > /dev/null 2>> test_log
 	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
+	testmake $?
 
 	#
 	# test standalone compilation with --with-nocl=PW
 	#
-	TEST="${S}standalone w/nocl w/logmon${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --enable-nocl="owl" --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test ${C_LOGFILE} > /dev/null 2>> test_log   
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
+	TEST="${S}standalone agent w/nocl${E}"
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --enable-nocl="owl" --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
+	#
+	testmake $?
 
 	#
 	# test standalone compilation w/ debug
 	#
-	TEST="${S}standalone w/debug${E}"
+	TEST="${S}standalone agent w/debug${E}"
 	#
 	if test -r "Makefile"; then
@@ -415,37 +131,23 @@
 	${TOP_SRCDIR}/configure --quiet --enable-debug  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  > /dev/null 2>> test_log  
 	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num debug || let "numfail = numfail + 1"  >/dev/null
+	testmake $?
 
 	#
 	# test standalone compilation w/ gpg
 	#
-	TEST="${S}standalone w/gpg${E}"
-	#
-	GPG=`find_path gpg`
-	let "num = num + 1" >/dev/null
-	#
-	if [ -z "$GPG" ]; then
-	    log_skip $num $MAXTEST 'gpg not in PATH'
-            let "num = num + 1" >/dev/null
-	    log_skip $num $MAXTEST 'gpg not in PATH'
-	else
-	    if test -r "Makefile"; then
-		$MAKE clean
-	    fi
-	    #
-	    ${TOP_SRCDIR}/configure --quiet --with-gpg=$GPG  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
-	    #
-	    testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	    let "num = num + 1" >/dev/null
-	    run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	fi
+	TEST="${S}standalone agent w/gpg${E}"
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --with-gpg=/usr/bin/gpg  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
+	#
+	testmake $?
 
 	#
 	# test standalone compilation w/stealth
 	#
-	TEST="${S}standalone w/stealth${E}"
+	TEST="${S}standalone agent w/stealth${E}"
 	#
 	if test -r "Makefile"; then
@@ -455,13 +157,10 @@
 	${TOP_SRCDIR}/configure --quiet --enable-stealth=128 --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
 	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test standalone compilation w/loginwatch
-	#
-	TEST="${S}standalone w/login-watch${E}"
+	testmake $?
+
+	#
+	# test standalone compilation w/logwatch
+	#
+	TEST="${S}standalone agent w/login-watch${E}"
 	#
 	if test -r "Makefile"; then
@@ -471,93 +170,23 @@
 	${TOP_SRCDIR}/configure --quiet --enable-login-watch  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
 	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test standalone compilation w/mysql
-	#
-	TEST="${S}standalone w/mysql${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-xml-log --with-database=mysql  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test standalone compilation w/mysql and stealth
-	#
-	TEST="${S}standalone w/mysql+stealth${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-xml-log --enable-stealth=128 --with-database=mysql  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test standalone compilation w/postgresql
-	#
-	TEST="${S}standalone w/postgresql${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-xml-log --with-database=postgresql  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test standalone compilation w/postgresql+stealth
-	#
-	TEST="${S}standalone w/postgresql+stealth${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-xml-log --enable-stealth=128 --with-database=postgresql  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test standalone compilation
-	#
-	TEST="${S}standalone w/o mail w/unix_rnd${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --disable-mail --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test --with-rnd=unix > /dev/null 2>> test_log  
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test standalone compilation
-	#
-	TEST="${S}standalone w/o external${E}"
+	testmake $?
+
+	#
+	# test standalone compilation
+	#
+	TEST="${S}standalone agent w/o mail${E}"
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --disable-mail --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  > /dev/null 2>> test_log  
+	#
+	testmake $?
+
+	#
+	# test standalone compilation
+	#
+	TEST="${S}standalone agent w/o external scripts${E}"
 	#
 	if test -r "Makefile"; then
@@ -567,8 +196,5 @@
 	${TOP_SRCDIR}/configure --quiet --disable-external-scripts --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
 	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
+	testmake $?
 
 	# echo; echo "${S}__ TEST CLIENT/SERVER __${E}"; echo;
@@ -585,9 +211,6 @@
 	${TOP_SRCDIR}/configure --quiet --enable-network=client  --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test   --with-timeserver=127.0.0.1 > /dev/null 2>> test_log   
 	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	
+	testmake $?
+	#
 	if test -r "Makefile"; then
 		$MAKE clean
@@ -596,254 +219,137 @@
 	${TOP_SRCDIR}/configure --quiet --enable-network=server  --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test   --with-timeserver=127.0.0.1 > /dev/null 2>> test_log   
 	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test client/server compilation w/prelude
-	#
-	TEST="${S}client/server application w/prelude${E}"
-	#
-	if [ -z "$doall" ]; then
-	    let "num = num + 1" >/dev/null
-	    [ -z "$quiet" ] && log_skip $num ${MAXTEST} "$TEST";
-	    let "num = num + 1" >/dev/null
-	    [ -z "$quiet" ] && log_skip $num ${MAXTEST} "$TEST (smatch)";
-
-	    let "num = num + 1" >/dev/null
-	    [ -z "$quiet" ] && log_skip $num ${MAXTEST} "$TEST";
-	    let "num = num + 1" >/dev/null
-	    [ -z "$quiet" ] && log_skip $num ${MAXTEST} "$TEST (smatch)";
-	else
-	    if test -r "Makefile"; then
-		$MAKE clean
-	    fi
-	    #
-	    ${TOP_SRCDIR}/configure --quiet --enable-network=client  --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test   --with-prelude > /dev/null 2>> test_log   
-	    #
-	    let "num = num + 1" >/dev/null
-	    testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	    let "num = num + 1" >/dev/null
-	    run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	    
-	    if test -r "Makefile"; then
-		$MAKE clean
-	    fi
-	    #
-	    ${TOP_SRCDIR}/configure --quiet --enable-network=server  --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test   --with-prelude > /dev/null 2>> test_log   
-	    #
-	    let "num = num + 1" >/dev/null
-	    testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	    let "num = num + 1" >/dev/null
-	    run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	    #
-	fi
+	testmake $?
+
+	#
+	# test c/s compilation w/ gpg
+	#
+	TEST="${S}client/server application w/gpg${E}"
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --enable-network=server  --enable-srp --with-gpg=/usr/bin/gpg  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
+	#
+	testmake $?
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --enable-network=client  --enable-srp --with-gpg=/usr/bin/gpg  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
+	#
+	testmake $?
+
 
 	#
 	# test client/server compilation
 	#
-	TEST="${S}client/server application static w/timeserver${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-network=client  --enable-static --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test   --with-timeserver=127.0.0.1 ${C_LOGFILE} > /dev/null 2>> test_log   
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-network=server  --enable-static --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test   --with-timeserver=127.0.0.1 > /dev/null 2>> test_log   
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	#
-	# test c/s compilation w/ gpg
-	#
-	TEST="${S}client/server application w/gpg${E}"
-	#
-	GPG=`find_path gpg`
-	let "num = num + 1" >/dev/null
-	#
-	if [ -z "$GPG" ]; then
-	    log_skip $num $MAXTEST 'gpg not in PATH'
-	    let "num = num + 1" >/dev/null
-	    log_skip $num $MAXTEST 'gpg not in PATH'
-	    let "num = num + 1" >/dev/null
-	    log_skip $num $MAXTEST 'gpg not in PATH'
-	    let "num = num + 1" >/dev/null
-	    log_skip $num $MAXTEST 'gpg not in PATH'
-	else
-	    if test -r "Makefile"; then
-		$MAKE clean
-	    fi
-	    #
-	    ${TOP_SRCDIR}/configure --quiet --enable-network=server  --enable-srp --with-gpg=$GPG  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
-	    #
-	    testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	    let "num = num + 1" >/dev/null
-	    run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	    #
-	    if test -r "Makefile"; then
-		$MAKE clean
-	    fi
-	    #
-	    ${TOP_SRCDIR}/configure --quiet --enable-network=client  --enable-srp --with-gpg=$GPG  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test ${C_LOGFILE} > /dev/null 2>> test_log   
-	    #
-	    let "num = num + 1" >/dev/null
-	    testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	    let "num = num + 1" >/dev/null
-	    run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	fi
-
+	TEST="${S}client/server application w/o srp${E}"
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --enable-network=server --disable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
+	#
+	testmake $?
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --enable-network=client --disable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
+	#
+	testmake $?
+
+	#
+	# test client/server compilation w/ debug
+	#
+	TEST="${S}client/server application w/debug${E}"
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --enable-network=server --enable-debug --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
+	#
+	testmake $?
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --enable-network=client --enable-debug --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
+	#
+	testmake $?
+
+	#
+	# test client/server compilation w/stealth
+	#
+	TEST="${S}client/server application w/stealth${E}"
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --enable-network=server  --enable-srp --enable-stealth=128 --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  > /dev/null 2>> test_log  
+	#
+	testmake $?
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --enable-network=client  --enable-srp --enable-stealth=128 --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  > /dev/null 2>> test_log  
+	#
+	testmake $?
+
+	#
+	# test  client/server compilation w/logwatch
+	#
+	TEST="${S}client/server application w/login-watch${E}"
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --enable-network=server  --enable-srp --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  > /dev/null 2>> test_log  
+	#
+	testmake $?
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --enable-network=client  --enable-srp --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  > /dev/null 2>> test_log  
+	#
+	testmake $?
 
 	#
 	# test client/server compilation
 	#
-	TEST="${S}client/server application w/o srp, w/udp${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-network=server --enable-udp --disable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-network=client --disable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test client/server compilation w/ debug
-	#
-	TEST="${S}client/server application w/debug${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-network=server --enable-debug --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num debug || let "numfail = numfail + 1"  >/dev/null
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-network=client --enable-debug --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test ${C_LOGFILE} > /dev/null 2>> test_log   
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num debug || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test client/server compilation w/stealth
-	#
-	TEST="${S}client/server application w/stealth${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-network=server  --enable-srp --enable-stealth=128 --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  > /dev/null 2>> test_log  
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-network=client  --enable-srp --enable-stealth=128 --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  > /dev/null 2>> test_log  
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test  client/server compilation w/logwatch
-	#
-	TEST="${S}client/server application w/login-watch,udp,no_ipv6${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-network=server  --enable-udp --disable-ipv6 --enable-srp --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  > /dev/null 2>> test_log  
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-network=client  --disable-ipv6 --enable-srp --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  > /dev/null 2>> test_log  
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
+	TEST="${S}client/server application w/o mail${E}"
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --enable-network=server  --disable-mail --enable-srp --enable-stealth=128 --enable-debug --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
+	#
+	testmake $?
+	#
+	if test -r "Makefile"; then
+		$MAKE clean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet --enable-network=client  --disable-mail --enable-srp --enable-stealth=128 --enable-debug --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
+	#
+	testmake $?
 
 	#
 	# test client/server compilation
 	#
-	TEST="${S}client/server application w/o mail${E}"
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-network=server  --disable-mail --enable-srp --enable-stealth=128 --enable-debug --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num debug || let "numfail = numfail + 1"  >/dev/null
-	#
-	if test -r "Makefile"; then
-		$MAKE clean
-	fi
-	#
-	${TOP_SRCDIR}/configure --quiet --enable-network=client  --disable-mail --enable-srp --enable-stealth=128 --enable-debug --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
-	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num debug || let "numfail = numfail + 1"  >/dev/null
-
-	#
-	# test client/server compilation
-	#
-	TEST="${S}client/server application w/o external${E}"
+	TEST="${S}client/server application w/o external scripts${E}"
 	#
 	if test -r "Makefile"; then
@@ -853,8 +359,5 @@
 	${TOP_SRCDIR}/configure --quiet --enable-network=server  --disable-srp --disable-external-scripts --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
 	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
+	testmake $?
 	#
 	if test -r "Makefile"; then
@@ -864,9 +367,14 @@
 	${TOP_SRCDIR}/configure --quiet --enable-network=client  --disable-srp --disable-external-scripts --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log   
 	#
-	let "num = num + 1" >/dev/null
-	testmake $? $num || let "numfail = numfail + 1" >/dev/null
-	let "num = num + 1" >/dev/null
-	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	log_end "COMPILE"
+	testmake $?
 }
+
+
+
+	testcompile
+
+
+# echo; echo "${S}__ END TEST COMPILE __${E}"; echo;
+
+exit
+
Index: trunk/test/testext.sh
===================================================================
--- trunk/test/testext.sh	(revision 591)
+++ trunk/test/testext.sh	(revision 1)
@@ -1,89 +1,102 @@
 #! /bin/sh
 
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
 
-MAXTEST=2; export MAXTEST
+# The following two are the ANSI sequences for start and end embolden
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
+
+PW_DIR=`pwd`
+
+if test x$UID != x; then
+  TRUST="--with-trusted=0,2,$UID"
+else
+  TRUST="--with-trusted=0,2"
+fi
+
+echo; echo "${S}__ STARTING TEST EXTERNAL PROGRAM __${E}"; echo;
+echo Working directory: $PW_DIR
+
+MAKE=`which gmake`
+if test "x$?" = x1 ; then
+    MAKE="make -s"
+else
+    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$MAKE" = x; then
+	MAKE="make -s"
+    elif test "x$MAKE" = xno; then
+	MAKE="make -s"
+    else
+	if test "x$MAKE" = "xwhich:"; then
+		MAKE="make -s"
+	else
+		MAKE="gmake -s"
+		gmake -v >/dev/null 2>&1 || MAKE="make -s"
+	fi
+    fi
+fi
+
+COMP=`which gcc`
+if test "x$?" = x1 ; then
+    COMP="cc"
+else
+    COMP=`which gcc | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$COMP" = x; then
+	COMP="cc"
+    elif test "x$COMP" = xno; then
+	COMP="cc"
+    else
+	if test "x$COMP" = "xwhich:"; then
+		COMP="cc"
+	else
+		COMP="gcc"
+		gcc -v >/dev/null 2>&1 || COMP="gcc"
+	fi
+    fi
+fi
+echo MAKE is $MAKE
+echo COMP is $COMP
+echo
+
 
 testext0 ()
 {
-        COMP=`which gcc`
-	if test "x$?" = x1 ; then
-	    COMP="cc"
-	else
-	    COMP=`which gcc | sed -e "s%\([a-z:]\) .*%\1%g"` 
-	    if test "x$COMP" = x; then
-		COMP="cc"
-	    elif test "x$COMP" = xno; then
-		COMP="cc"
-	    else
-	    if test "x$COMP" = "xwhich:"; then
-		COMP="cc"
-	    else
-		COMP="gcc"
-		gcc -v >/dev/null 2>&1 || COMP="gcc"
-	    fi
-	    fi
-	fi
-	log_start "EXTERNAL PROGRAM"
-	[ -z "$verbose" ] || echo MAKE is $MAKE
-	[ -z "$verbose" ] || { echo COMP is $COMP; echo; }
 	#
 	# standalone compilation
 	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
+	echo "${S}Building standalone agent${E}"; echo;
 	#
 	if test -r "Makefile"; then
-	    ${MAKE} distclean >/dev/null
+		${MAKE} distclean
 	fi
 	#
-	${TOP_SRCDIR}/configure --quiet --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/testrc_1ext --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file 
+	${TOP_SRCDIR}/configure --quiet --enable-debug --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/testrc_1ext --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file 
 	#
 	if test x$? = x0; then
-	    [ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-	    $MAKE  >/dev/null 2>>test_log
-	    if test x$? = x0; then
-		[ -z "$verbose" ] || log_msg_ok "make..."; 
-	    else
-		[ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		return 1
-	    fi
-	    
+		echo "configure completed, exit status 0"; echo;
+		${MAKE}  > /dev/null
+		echo "${MAKE} completed, exit status $?"; echo;
 	else
-	    [ -z "$quiet" ] &&       log_msg_fail "configure...";
-	    return 1
+		echo "ERROR: configure failed"; echo;
 	fi
-	#
+
 	# prepare the program
 	#
 	cat test/test_ext.c.in | sed -e "s%MYPWDIR%$PW_DIR/test_ext.res%g" > test_ext.c
-    
+	
 	${COMP} -o test_ext test_ext.c 
 	if test "x$?" != x0; then
-	    log_msg_fail "${COMP} -o test_ext test_ext.c"
-	    return 1
+	    echo "FAIL: ${COMP} -o test_ext test_ext.c"
+	    exit 1
 	fi
-	chmod +rx  test_ext
-	if test "x$?" != x0; then
-	    log_msg_fail "chmod +rx  test_ext"
-	    return 1
-	fi
-    
+	chmod +rx  $PW_DIR/test_ext
+
 	# compute checksum and fix config file
 	#
@@ -93,71 +106,32 @@
 	echo "SetType=log"                  >> testrc_1ext
 	echo "SetChecksum=$CHKSUM"          >> testrc_1ext
-	echo "SetEnviron=TZ=Europe/Berlin"  >> testrc_1ext
 	echo "SetFilterOr=ALERT"            >> testrc_1ext
-	echo "CloseCommand"                 >> testrc_1ext
-	echo "OpenCommand=$PW_DIR/test_ext" >> testrc_1ext
-	echo "SetType=log"                  >> testrc_1ext
-	echo "SetChecksum=$CHKSUM"          >> testrc_1ext
-	echo "SetFilterOr=ALERT"            >> testrc_1ext
-	echo "CloseCommand"                 >> testrc_1ext
-    
-	rm -f $PW_DIR/test_ext.res
-	rm -f $PW_DIR/pdbg.child
-	rm -f $PW_DIR/pdbg.main
-	./samhain -p none
-    
-	# The shell is too fast ...
-	one_sec_sleep
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Logged by external C program test_ext (filtered: ALERT only):${E}"; 
-	    echo;
-	    cat $PW_DIR/test_ext.res
-	    echo
-	}
-
-	tmp=`cat $PW_DIR/test_ext.res | wc -l`
-	if [ $tmp -eq 8 ]; then
-	    tmp=`egrep 'RECV: \[EOF\]' $PW_DIR/test_ext.res | wc -l`
-	    if [ $tmp -eq 4 ]; then
-		tmp=`egrep 'RECV: ALERT' $PW_DIR/test_ext.res | wc -l`
-		if [ $tmp -eq 4 ]; then
-		    log_ok 1 ${MAXTEST};
-		else
-		    log_fail 1 ${MAXTEST};
-		fi
-	    else
-		log_fail 1 ${MAXTEST};
-	    fi
-	else
-	    log_fail 1 ${MAXTEST};
-	fi
-
-	ORIGINAL="SetChecksum=${CHKSUM}"
-	REPLACEMENT="SetChecksum=DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF"
-
-	ex -s "$PW_DIR/testrc_1ext" <<EOF
-%s/$ORIGINAL/$REPLACEMENT/g
-wq
-EOF
 
 	rm -f $PW_DIR/test_ext.res
 	rm -f $PW_DIR/pdbg.child
 	rm -f $PW_DIR/pdbg.main
-	./samhain -p none
-    
-	one_sec_sleep
-
-	if [ -f $PW_DIR/test_ext.res ]; then
-	    log_fail 2 ${MAXTEST};
-	else
-	    log_ok   2 ${MAXTEST};
-	fi
+	./samhain 
+	
+	# The shell is too fast ...
+ 	sleep 1
+	echo; 
+	echo "${S}Logged by external C program test_ext (filtered: ALERT only):${E}"; 
+	echo;
+	cat $PW_DIR/test_ext.res
+	echo;
 
 	rm -f $PW_DIR/.samhain_file
-	rm -f $LOGFILE
+	rm -f $PW_DIR/.samhain_log
 	rm -f $PW_DIR/.samhain_lock
-
-	log_end "EXTERNAL PROGRAM"
+	
 }
 
+
+
+	testext0
+
+
+echo; echo "${S}__ END TEST EXTERNAL PROGRAM __${E}"; echo;
+
+exit
+
Index: trunk/test/testhash.sh
===================================================================
--- trunk/test/testhash.sh	(revision 591)
+++ trunk/test/testhash.sh	(revision 1)
@@ -1,57 +1,51 @@
 #! /bin/sh
 
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
 
-RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
+# The following two are the ANSI sequences for start and end embolden
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
 
-MAXTEST=2; export MAXTEST
+PW_DIR=`pwd`
+
+if test x$UID != x; then
+  TRUST="--with-trusted=0,2,$UID"
+else
+  TRUST="--with-trusted=0,2"
+fi
+
+#echo; echo "${S}__ STARTING TEST HASH FUNCTION __${E}"; echo;
+#echo Working directory: $PW_DIR
+
+MAKE=`which gmake`
+if test "x$?" = x1 ; then
+    MAKE="make -s"
+else
+    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$MAKE" = x; then
+	MAKE="make -s"
+    elif test "x$MAKE" = xno; then
+	MAKE="make -s"
+    else
+	if test "x$MAKE" = "xwhich:"; then
+		MAKE="make -s"
+	else
+		MAKE="gmake -s"
+		gmake -v >/dev/null 2>&1 || MAKE="make -s"
+	fi
+    fi
+fi
+
+
 
 testhash ()
 {
-	log_start "HASH FUNCTION"
-
-	C_LOGFILE=""
-
-	ls /lib/libpcre* >/dev/null 2>&1
-	if [ $? -eq 0 ]; then
-	    C_LOGFILE=" --enable-logfile-monitor "
-	else
-	    ls /usr/lib/libpcre* >/dev/null 2>&1
-	    if [ $? -eq 0 ]; then
-		C_LOGFILE=" --enable-logfile-monitor "
-	    else
-                ls /usr/lib/*/libpcre* >/dev/null 2>&1
-                if [ $? -eq 0 ]; then
-                    C_LOGFILE=" --enable-logfile-monitor "
-                else
-                    ls /usr/local/lib/libpcre* >/dev/null 2>&1
-                    if [ $? -eq 0 ]; then
-                        C_LOGFILE=" --enable-logfile-monitor "
-                    fi
-                fi
-	    fi
-	fi
-	if [ x"${C_LOGFILE}" = x ]; then
-	    log_msg_ok  "Not testing  --enable-logfile-monitor";
-	fi
-
 	#
 	# test standalone compilation
@@ -63,27 +57,18 @@
 	fi
 	#
-	${TOP_SRCDIR}/configure --enable-debug=gdb --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-db-reload '--enable-login-watch' '--enable-mounts-check' ${C_LOGFILE} '--enable-port-check' '--enable-process-check' '--enable-message-queue' '--enable-suidcheck' '--disable-dnmalloc'
-	#
-	fail=0
+	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  > /dev/null 2>> test_log  
 	#
 	if test x$? = x0; then
-		[ -z "$verbose" ] || log_msg_ok  "configure...";
+		echo "PASS: configure ${TEST}"; 
 		$MAKE  > /dev/null 2>> test_log
 		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make...";
+		    echo "PASS: $MAKE  ${TEST}";
  		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make...";
-		    fail=1
+		    echo "FAIL: $MAKE  ${TEST} (see ./test_log)";
 		fi
 	else
-		[ -z "$quiet" ] && log_msg_fail "configure...";
-		fail=1
+		echo "FAIL: configure  ${TEST} (see ./test_log)"; 
 	fi
-	#
-	if [ $fail -eq 1 ]; then
-	    [ -z "$quiet" ] && log_fail 1 ${MAXTEST};
-	    return 1
-	fi
-	#
+
 	echo "Test results of the TIGER hash algorithm" > testhash.tmp
 	echo >> testhash.tmp
@@ -99,37 +84,23 @@
 	./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge, 1996." >> testhash.tmp
 	./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-" >> testhash.tmp
-	#
-	RESU=`diff testhash.tmp ${SCRIPTDIR}/testtiger.txt 2>/dev/null`
+
+	# echo
+	# echo "${S}diff testhash.tmp testtiger.txt (empty == success):${E}" 
+	# echo
+	RESU=`diff testhash.tmp ${SCRIPTDIR}/testtiger.txt`
 	if test "x${RESU}" = "x"; then
-	    [ -z "$quiet" ] && log_ok   1 ${MAXTEST};
+	    echo "PASS: test_hash"
 	else
-	    [ -z "$quiet" ] && log_fail 1 ${MAXTEST};
-	    return 1
+	    echo "FAIL: test_hash"
 	fi
-        #
-        #
-        #
-        TEST="${S}files${E}"
-        #
-        case $SCRIPTDIR in
-            /*)
-                testpath="${SCRIPTDIR}/testtiger.txt";;
-            *)
-                testpath="`pwd`/${SCRIPTDIR}/testtiger.txt";;
-        esac
-        #
-        RESU=`./samhain -H ${testpath}`
-        #
-        if test x"$RESU" = x"${testpath}: 8125E439 4E7E20F9 24FD8E37  BC4D90C7 FC67F40C 1681F05D"; then
-            [ -z "$quiet" ] && log_ok   2 ${MAXTEST};
-        else
-            [ -z "$quiet" ] && log_fail 2 ${MAXTEST};
-            return 1
-        fi
-        #
-	log_end "HASH FUNCTION"
-	return 0
 }
 
 
 
+	testhash
+
+
+#echo; echo "${S}__ END TEST HASH FUNCTION __${E}"; echo;
+
+exit
+
Index: trunk/test/testrc_1
===================================================================
--- trunk/test/testrc_1	(revision 591)
+++ trunk/test/testrc_1	(revision 1)
@@ -35,5 +35,5 @@
 # for these files, only changes in permissions and ownership are checked
 #
-#file=/etc/mtab
+file=/etc/mtab
 #file=/etc/ssh_random_seed
 #file=/etc/asound.conf
@@ -79,5 +79,5 @@
 # dir=/usr/bin
 
-#dir=/usr/bin
+dir=/usr/bin
 #dir=/lib
 #dir=/usr/lib
@@ -89,54 +89,7 @@
 # dir=1/home/rainer
 
-[SuidCheck]
-SuidCheckActive=false
-#SuidCheckExclude=/home
-
-[ProcessCheck]
-#
-# Activate (default is on)
-#
-ProcessCheckActive = no
-	  
-[PortCheck]
-#
-# Activate (default is on)
-#
-PortCheckActive = no
-
-
-[Logmon]
-	  
-#
-# Switch on the module
-#
-LogmonActive = yes
-
-# Check every second
-#
-LogmonInterval = 1
-
-# Strip PIDs from syslog messages
-#
-Logmonhidepid = true
-
-# Define a queue with severity 'crit'.
-# This is a 'report' queue, hence 'interval' (10)
-# will be ignored.
-#
-LogmonQueue = q1:10:report:crit
-
-# Monitor disks to check for full /dev/sda1
-#
-LogmonWatch = SHELL:df -h
-
-# Warn about disk /dev/sda1 nearly full (80% or more. Use a 
-# non-capturing subexpression [the (?:8|9)] for the percentage full.
-#
-LogmonRule = q1:/dev/nvme1n1p4\s+[0-9GM.]+\s+[0-9GM.]+\s+[0-9GM.]+\s+(?:8|9).%.*
-
-LogmonDeadtime = 120
-LogmonRule = trash:.*
-
+#[SuidCheck]
+#SuidCheckActive=T
+# SuidCheckExclude=/net/localhost
 
 [EventSeverity]
@@ -192,5 +145,5 @@
 # Restrict to certain classes of messages
 # MailClass = RUN
-#PreludeSeverity = err
+PreludeSeverity = err
 
 # Which system calls to log (execve, utime, unlink, dup, chdir, open, kill,
@@ -208,19 +161,19 @@
 #KernelCheckInterval = 20
 
-#[Utmp]
+[Utmp]
 #
 # 0 to switch off, 1 to activate
 #
-#LoginCheckActive=1
+LoginCheckActive=1
 
 # Severity for logins, multiple logins, logouts
 # 
-#SeverityLogin=info
-#SeverityLoginMulti=warn
-#SeverityLogout=info
+SeverityLogin=info
+SeverityLoginMulti=warn
+SeverityLogout=info
 
 # interval for login/logout checks
 #
-#LoginCheckInterval=60
+LoginCheckInterval=60
 
 [Misc]
@@ -266,5 +219,5 @@
 # MailSubject=* body %H # %M
 
-#TrustedUser=uucp,fax,fnet
+TrustedUser=uucp,fax,fnet
 
 # Watch syslog port
Index: trunk/test/testrc_1i.dyn
===================================================================
--- trunk/test/testrc_1i.dyn	(revision 591)
+++ 	(revision )
@@ -1,40 +1,0 @@
-untrusted comment: verify with samhain.pub
-RWRGHbBcvfnUvI+f5wRdzGBIpcVr3e3YJoB9f7ltII+sWwTpKBjfh60VkC0e/svAHFR03LIwALRz8CB70EokYYa3FVnmPgWv5Qg=
-
-[Attributes]
-file=/etc
-
-# not really logfiles, but almost guaranteed to exist
-[GrowingLogFiles]
-file=/etc/services
-file=/etc/hosts
-file=/etc/motd
-
-[EventSeverity]
-SeverityUser0=crit
-SeverityUser1=crit
-SeverityReadOnly=crit
-SeverityLogFiles=crit
-SeverityGrowingLogs=crit
-SeverityIgnoreNone=crit
-SeverityAttributes=crit
-SeverityIgnoreAll=warn
-SeverityFiles=notice
-SeverityDirs=info
-SeverityNames=warn
-
-[Log]
-MailSeverity=none
-LogSeverity=warn
-SyslogSeverity=none
-PrintSeverity=info
-
-[Misc]
-Daemon=no
-SetFilecheckTime=120
-SetRecursionLevel=10
-SetLoopTime=60
-ReportFullDetail = no
-ChecksumTest=check
-
-[EOF]
Index: trunk/test/testrc_2.in
===================================================================
--- trunk/test/testrc_2.in	(revision 591)
+++ trunk/test/testrc_2.in	(revision 1)
@@ -1,6 +1,2 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-NotDashEscaped: You need GnuPG to verify this message
-
 #####################################################################
 #
@@ -32,21 +28,38 @@
 
 
+[Attributes]
+#
+# for these files, only changes in permissions and ownership are checked
+#
+file=/etc/mtab
+#file=/etc/ssh_random_seed
+#file=/etc/asound.conf
+#file=/etc/resolv.conf
+file=/etc/localtime
+#file=/etc/ioctl.save
+#file=/etc/passwd.backup
+#file=/etc/shadow.backup
+
+#
+# There are files in /etc that might change, thus changing the directory
+# timestamps. Put it here as 'file', and in the ReadOnly section as 'dir'.
+#
+file=/etc
+
+
+[GrowingLogFiles]
+#
+# for these files, changes in signature, timestamps, and increase in size
+#                  are ignored 
+#
+file=/var/log/messages
+
+
 [ReadOnly]
 #
 # for these files, only access time is ignored
 #
-# dir=/usr/bin
-# dir=/bin
-
-file = /var
-file = /bin
-file = /usr
-file = /tmp
-file = /etc
-
-# hopefully does not exist
-file=/etc/toodleedoo
-
-dir=1/usr
+dir=/usr/bin
+#dir=/bin
 
 [EventSeverity]
@@ -99,5 +112,5 @@
 SyslogSeverity=none
 ExportSeverity=none
-DatabaseSeverity=none
+DatabaseSeverity=info
 
 #databaseseverity=info
@@ -110,5 +123,5 @@
 #AddToDBHash=log_msg
 # AddToDBHash=log_host
-UsePersistent = True
+
 
 [Utmp]
@@ -133,14 +146,11 @@
 Daemon=no
 
-SetOutgoingIP = 127.0.0.1
-SetServerInterface = 127.0.0.1
-
-UseSeparateLogs=no
+SetOutgoingIP=127.0.0.1
+
+UseSeparateLogs=yes
 
 SetUseSocket = yes
-SetSocketAllowUid=0
-SetSocketPassword=samhain
-
-SetClientFromAccept = yes
+
+#SetClientFromAccept = yes
 
 SetUdpActive=no
@@ -196,5 +206,5 @@
 
 # timer for time stamps
-SetLoopTime=10
+SetLoopTime=30
 
 # trusted users (root and the effective user are always trusted)
@@ -208,9 +218,2 @@
 
 [Clients]
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEARECAAYFAlUTGCcACgkQGq0myA9XH2zINACfQb/Wfa19OBbHVkw9uBNMB+lF
-cwUAnR0Geb+sFDcv7JsrrTjY8htjPHd2
-=7wXO
------END PGP SIGNATURE-----
Index: trunk/test/testrc_2.in.asc
===================================================================
--- trunk/test/testrc_2.in.asc	(revision 591)
+++ 	(revision )
@@ -1,216 +1,0 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-NotDashEscaped: You need GnuPG to verify this message
-
-#####################################################################
-#
-# Configuration file template for samhain.
-#
-#####################################################################
-# 
-# -- empty lines and lines starting with '#' are ignored 
-# -- you can PGP clearsign this file -- samhain will check (if compiled
-#    with support) or otherwise ignore the signature
-# -- CHECK mail address
-#
-# To each log facility, you can assign a threshold severity. Only
-# reports with at least the threshold severity will be logged
-# to the respective facility (even further below).
-#
-#####################################################################
-#
-# SETUP for file system checking:
-# 
-# (i)   There are several policies, each has its own section. Put files
-#       into the section for the appropriate policy (see below).
-# (ii)  To each policy, you can assign a severity (further below).
-# (iii) To each log facility, you can assign a threshold severity. Only
-#       reports with at least the threshold severity will be logged
-#       to the respective facility (even further below).
-#
-#####################################################################
-
-
-[ReadOnly]
-#
-# for these files, only access time is ignored
-#
-# dir=/usr/bin
-# dir=/bin
-
-file = /var
-file = /bin
-file = /usr
-file = /tmp
-file = /etc
-
-# hopefully does not exist
-file=/etc/toodleedoo
-
-dir=1/usr
-
-[EventSeverity]
-#
-# Here you can assign severities to policy violations.
-# If this severity exceeds the treshold of a log facility (see below),
-# a policy violation will be logged to that facility.
-#
-# Severity for verification failures.
-#
-SeverityReadOnly=crit
-SeverityLogFiles=crit
-SeverityGrowingLogs=crit
-SeverityIgnoreNone=crit
-SeverityAttributes=crit
-#
-# We have a file in IgnoreAll that might or might not be present.
-# Setting the severity to 'info' prevents messages about deleted/new file.
-#
-SeverityIgnoreAll=info
-
-#
-# Files : file access problems
-# Dirs  : directory access problems
-# Names : suspect (non-printable) characters in a pathname
-#
-SeverityFiles=crit
-SeverityDirs=crit
-SeverityNames=warn
-
-[Log]
-#
-# Set threshold severity for log facilities
-# Values: debug, info, notice, warn, mark, err, crit, alert, none.
-# 'mark' is used for timestamps.
-#
-# By default, everything equal to and above the threshold is logged.
-# The specifiers '*', '!', and '=' are interpreted as  
-# 'all', 'all but', and 'only', respectively (like syslogd(8) does, 
-# at least on Linux). 
-# 
-# MailSeverity=*
-# MailSeverity=!warn
-# MailSeverity==crit
-#
-MailSeverity=none
-PrintSeverity=info
-#PRINTClass = "RUN FIL STAMP"
-LogSeverity=none
-SyslogSeverity=none
-ExportSeverity=none
-DatabaseSeverity=none
-
-#databaseseverity=info
-
-[Database]
-# setdbname=samhain
-# setdbtable=log
-setdbuser=samhain
-setdbpassword=samhain
-#AddToDBHash=log_msg
-# AddToDBHash=log_host
-UsePersistent = True
-
-[Utmp]
-#
-# 0 to switch off, 1 to activate
-#
-LoginCheckActive=1
-
-# Severity for logins, multiple logins, logouts
-# 
-SeverityLogin=info
-SeverityLoginMulti=warn
-SeverityLogout=info
-
-# interval for login/logout checks
-#
-LoginCheckInterval=60
-
-[Misc]
-#
-# whether to become a daemon process
-Daemon=no
-
-SetOutgoingIP = 127.0.0.1
-SetServerInterface = 127.0.0.1
-
-UseSeparateLogs=no
-
-SetUseSocket = yes
-SetSocketAllowUid=0
-SetSocketPassword=samhain
-
-SetClientFromAccept = yes
-
-SetUdpActive=no
-
-# the maximum time between client messages (seconds)
-# (this is a log server-only option; the default is 86400 sec = 1 day
-#
-# SetClientTimeLimit=1800
-
-UseClientSeverity = yes
-UseClientClass    = yes
-
-# Format for message headers
-#
-# MessageHeader="%S %T %F %L  "
-
-# priority for peer != address as notified by client
-# (lookup may fail on firewalled client)
-#
-# SeverityLookup = warn
-
-# time till next file check (seconds)
-SetFilecheckTime=600
-
-# Only highest-level (alert) reports will be mailed immediately,
-# others will be queued. Here you can define, when the queue will
-# be flushed (Note: the queue is automatically flushed after
-# completing a file check).
-#
-# maximum time till next mail (seconds)
-SetMailTime=86400
-
-# maximum number of queued mails
-SetMailNum=10
-
-# where to send mail to
-SetMailAddress=root@localhost
-
-# mail relay host
-# SetMailRelay=relay.yourdomain.de
-
-# The binary. Setting the path will allow
-# samhain to check for modifications between
-# startup and exit.
-#
-# SamhainPath=/usr/local/bin/samhain
-
-# where to get time from
-# SetTimeServer=www.yourdomain.de
-
-# where to export logs to
-SetLogServer=localhost
-
-# timer for time stamps
-SetLoopTime=10
-
-# trusted users (root and the effective user are always trusted)
-# TrustedUser=bin
-
-# whether to test signature of files (init/check/none)
-# - if 'none', then we have to decide this on the command line -
-#
-ChecksumTest=check
-
-
-[Clients]
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEARECAAYFAlUTGCcACgkQGq0myA9XH2zINACfQb/Wfa19OBbHVkw9uBNMB+lF
-cwUAnR0Geb+sFDcv7JsrrTjY8htjPHd2
-=7wXO
------END PGP SIGNATURE-----
Index: trunk/test/testrun_1.sh
===================================================================
--- trunk/test/testrun_1.sh	(revision 591)
+++ trunk/test/testrun_1.sh	(revision 1)
@@ -1,1306 +1,130 @@
 #! /bin/sh
 
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
 
-RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
+# The following two are the ANSI sequences for start and end embolden
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
 
-# --enable-login-watch --enable-xml-log 
-# --enable-debug --enable-suidcheck --with-prelude
+PW_DIR=`pwd`
 
-BUILDOPTS="--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"
-export BUILDOPTS
+if test x$UID != x; then
+#  TRUST="--with-trusted=0,2"
+  TRUST="--with-trusted=0,2,$UID"
+else
+  TRUST="--with-trusted=0,2,500"
+fi
 
-BASE="${PW_DIR}/testrun_testdata"; export BASE
-TDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c"; export TDIRS
-TFILES="x y z"; export TFILES
+echo; echo "${S}__ STARTING TEST RUN STANDALONE __${E}"; echo;
+echo Working directory: $PW_DIR
 
-###########################################################
-#
-# ---- [Define tests here] ----
-#
-
-# 1 for testing new tests
-testrun1_setup=0
-
-MAXTEST=15; export MAXTEST
-MAXTEST_3=15; export MAXTEST_3
-
-test_dirs () {
-    for ff in $CDIRS; do
-	#
-	egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (checking)";
-	    return 1
-	fi
-	tmp=`egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE 2>/dev/null | wc -l`
-	if [ $tmp -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (multiple)";
-	fi
-	#
-    done
-    for ff in $NDIRS; do
-	#
-	egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (checking)";
-	    return 1
-	fi
-    done
-}
-
-
-TESTPOLICY_15="
-[Misc]
-DigestAlgo=SHA1
-RedefReadOnly = +TXT
-[ReadOnly]
-dir=${BASE}
-"
-mod_testdata_15 () {
-    mod_testdata_1
-}
-chk_testdata_15 () {
-    chk_testdata_1
-}
-
-TESTPOLICY_14="
-[Misc]
-DigestAlgo=MD5
-RedefReadOnly = +TXT
-[ReadOnly]
-dir=${BASE}
-"
-mod_testdata_14 () {
-    mod_testdata_1
-}
-chk_testdata_14 () {
-    chk_testdata_1
-}
-
-# 
-# combine file check schedule with one-shot mode 
-# 
-TESTPOLICY_13="
-[ReadOnly]
-dir=99${BASE}
-"
-
-mod_testdata_13 () {
-    one_sec_sleep 
-    echo "foobar" >"${BASE}/c/x"; # bad
-    chmod 0555  "${BASE}/a/y";    # bad
-    ORIGINAL='SetFilecheckTime=60'
-    REPLACEMENT='FileCheckScheduleOne = 6 12 * * *'
-    ex -s $RCFILE <<EOF
-%s/${ORIGINAL}/${REPLACEMENT}/g
-wq
-EOF
-}
-
-chk_testdata_13 () {
-    # CDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne 2 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/c/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/c/x";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] -----M--T-.*${BASE}/a/y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/y";
-	return 1
-    fi
-    CDIRS="a a/a a/b a/c c b a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
-    NDIRS="";
-    test_dirs;
-    return $?
-}
-
-TESTPOLICY_12="
-[ReadOnly]
-dir=99${BASE}
-[IgnoreAll]
-dir=-1${BASE}/b
-[Attributes]
-dir=1${BASE}/a
-"
-
-mod_testdata_12 () {
-    one_sec_sleep
-    echo "foobar" >"${BASE}/b/x"; # ok
-    echo "foobar" >"${BASE}/c/x"; # bad
-    echo "foobar" >"${BASE}/a/x"; # ok
-    chmod 0555  "${BASE}/a/a/x";  # bad
-    chmod 0555  "${BASE}/a/a/a/x";# ok
-    chmod 0555  "${BASE}/a/y";    # bad
-}
-
-chk_testdata_12 () {
-    # CDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne 3 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/c/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/c/x";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/a/a/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/x";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/a/y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/y";
-	return 1
-    fi
-    CDIRS="a a/a a/b a/c c";
-    NDIRS="b a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
-    test_dirs;
-    return $?
-}
-
-#
-# --- ACL/SELinux test case
-#
-TESTPOLICY_11="
-[Misc]
-UseAclCheck=yes
-UseSelinuxCheck=yes
-[ReadOnly]
-dir=99${BASE}
-[IgnoreAll]
-dir=-1${BASE}/b
-[Attributes]
-dir=1${BASE}/a
-[Misc]
-UseSelinuxCheck = no
-UseAclCheck = no
-"
-
-mod_testdata_11 () {
-    one_sec_sleep
-    setfacl -m 'user:nobody:r--' "${BASE}/b/x"; # ok (ign)
-    setfacl -m 'user:nobody:r--' "${BASE}/c/x"; # bad
-    setfacl -m 'user:nobody:r--' "${BASE}/a/x"; # bad
-    setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/b/y";    # ok (ign)
-    setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/a/a/a/x";# ok (depth)
-    setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/a/x";    # bad
-    setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/a/y";    # bad
-}
-
-chk_testdata_11 () {
-    # CDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne 1 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] --------T-.*${BASE}/c/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/c/x";
-	return 1
-    fi
-    CDIRS="a a/a a/b a/c c";
-    NDIRS="b a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
-    test_dirs;
-    return $?
-}
-
-TESTPOLICY_10="
-[Misc]
-UseAclCheck=yes
-UseSelinuxCheck=yes
-[ReadOnly]
-dir=99${BASE}
-[IgnoreAll]
-dir=-1${BASE}/b
-[Attributes]
-dir=1${BASE}/a
-"
-
-mod_testdata_10 () {
-    one_sec_sleep
-    setfacl -m 'user:nobody:r--' "${BASE}/b/x"; # ok (ign)
-    setfacl -m 'user:nobody:r--' "${BASE}/c/x"; # bad
-    setfacl -m 'user:nobody:r--' "${BASE}/a/x"; # bad
-    setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/b/y";    # ok (ign)
-    setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/a/a/a/x";# ok (depth)
-    setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/a/x";    # bad
-    setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/a/y";    # bad
-}
-
-chk_testdata_10 () {
-    # CDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne 5 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] -----M--T-.*${BASE}/c/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/c/x";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/a/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/x";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/a/y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/y";
-	return 1
-    fi
-    CDIRS="a a/a a/b a/c c";
-    NDIRS="b a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
-    test_dirs;
-    return $?
-}
-
-TESTPOLICY_9="
-[ReadOnly]
-dir=0${BASE}/b
-[Attributes]
-dir=2${BASE}/a/a
-"
-
-mod_testdata_9 () {
-    echo "foobar" >"${BASE}/b/x"; 
-    echo "foobar" >"${BASE}/a/x"; 
-    echo "foobar" >"${BASE}/x"; 
-}
-
-chk_testdata_9 () {
-    # CDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne 1 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-    CDIRS="b a/a a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
-    NDIRS="a c a/b a/c";
-    test_dirs;
-    return $?
-}
-
-TESTPOLICY_8="
-[ReadOnly]
-dir=1${BASE}
-[Attributes]
-dir=1${BASE}/a/a
-"
-
-mod_testdata_8 () { 
-    echo "foobar" >"${BASE}/a/x"; 
-    chmod 0555 "${BASE}/a/a/a/b/x"; 
-}
-
-chk_testdata_8 () {
-    # CDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne 1 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-    CDIRS="a b c a/a a/a/a a/a/b a/a/c";
-    NDIRS="a/b a/c a/a/a/a a/a/a/b a/a/a/c";
-    test_dirs;
-    return $?
-}
-
-
-TESTPOLICY_7="
-[ReadOnly]
-dir=${BASE}
-[Attributes]
-dir=${BASE}/a/a
-[GrowingLogFiles]
-dir=${BASE}/a/a/a
-[IgnoreAll]
-file=${BASE}/a/a/a/z
-dir=${BASE}/b
-[Misc]
-IgnoreMissing=${BASE}/a/[[:alnum:]]+/[[:alnum:]]+\$
-IgnoreAdded=${BASE}/a/(b|c)/[[:alnum:]]+\$
-"
-
-mod_testdata_7 () {
-    one_sec_sleep 
-    echo "foobar" >"${BASE}/a/a/a/z" # ok
-    echo "foobar" >"${BASE}/a/a/a/x" # bad
-    echo "foobar" >"${BASE}/a/a/x"   # ok
-    echo "foobar" >"${BASE}/a/x"     # bad
-    chmod 0555     "${BASE}/a"       # bad
-    chmod 0555     "${BASE}/b"       # ok
-
-    rm    "${BASE}/a/c/z"
-    touch "${BASE}/a/c/zz2"
-}
-
-
-chk_testdata_7 () {
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne 4 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-    egrep "ERROR.*POLICY MISSING.*${BASE}/a/c/z" $LOGFILE >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/c/z";
-	return 1
-    fi
-    egrep "CRIT.*POLICY ADDED.*${BASE}/a/c/zz2" $LOGFILE >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/c/zz2";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[GrowingLogs\] C--------S.*${BASE}/a/a/a/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/a/x";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] -----M--T-.*${BASE}/a" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/a/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/x";
-	return 1
-    fi
-}
-
-
-TESTPOLICY_6="
-[ReadOnly]
-dir=${BASE}
-[Attributes]
-file=${BASE}/a/y
-file=${BASE}/b/y
-file=${BASE}/c/y
-file=${BASE}/a/a/y
-file=${BASE}/a/b/y
-file=${BASE}/a/c/y
-file=${BASE}/a/a/a/y
-file=${BASE}/a/a/b/y
-file=${BASE}/a/a/c/y
-file=${BASE}/a/a/a/a/y
-file=${BASE}/a/a/a/b/y
-file=${BASE}/a/a/a/c/y
-"
-
-mod_testdata_6 () {
-    one_sec_sleep
-    for ff in $TDIRS; do
-	echo "foobar" >"${BASE}/${ff}/x"
-	chmod 0555     "${BASE}/${ff}/y"
-	echo "foobar" >"${BASE}/${ff}/z"
-    done
-}
-
-chk_testdata_6 () {
-    count6=0
-    for ff in $TDIRS; do
-	#
-	egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (checking)";
-	    return 1
-	fi
-	tmp=`egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE 2>/dev/null | wc -l`
-	if [ $tmp -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (multiple)";
-	fi
-	#
-	for gg in $TFILES; do
-	    egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE >/dev/null 2>&1
-	    if [ $? -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (checking)";
-	    fi
-	    tmp=`egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE 2>/dev/null | wc -l`
-	    if [ $tmp -ne 1 ]; then
-		[ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (multiple)";
-	    fi
-	done
-	egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/${ff}/x" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/x";
-	    return 1
-	fi
-	let "count6 = count6 + 1" >/dev/null
-	egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/${ff}/z" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/z";
-	    return 1
-	fi
-	let "count6 = count6 + 1" >/dev/null
-	egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/${ff}/y" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/y";
-	    return 1
-	fi
-	let "count6 = count6 + 1" >/dev/null
-    done
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne $count6 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-}
-
-TESTPOLICY_5="
-[Attributes]
-dir=${BASE}
-file=${BASE}/a/a/c/x
-[ReadOnly]
-file=${BASE}/a/a/c/y
-[GrowingLogFiles]
-dir=${BASE}/a/a/c
-dir=${BASE}/a/a/b
-dir=${BASE}/a/b
-"
-
-mod_testdata_5 () {
-    mod_testdata_4
-    echo "1 This is a xxxx file" > "${BASE}/a/a/b/x"     # GrowingLogFiles
-    echo "1 This is a test file" > "${BASE}/a/a/b/y"     # GrowingLogFiles
-    echo "2 This is a test file" >> "${BASE}/a/a/b/y"    # GrowingLogFiles
-    echo "1 This is a xxxx file bad" > "${BASE}/a/a/b/z" # GrowingLogFiles
-    echo "2 This is a xxxx file bad" >>"${BASE}/a/a/b/z" # GrowingLogFiles
-    echo "3 This is a xxxx file bad" >>"${BASE}/a/a/b/z" # GrowingLogFiles
-}
-
-chk_testdata_5 () {
-    for ff in $TDIRS; do
-	#
-	egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (checking)";
-	    return 1
-	fi
-	tmp=`egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE 2>/dev/null | wc -l`
-	if [ $tmp -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (multiple)";
-	fi
-	#
-	for gg in $TFILES; do
-	    egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE >/dev/null 2>&1
-	    if [ $? -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (checking)";
-	    fi
-	    tmp=`egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE 2>/dev/null | wc -l`
-	    if [ $tmp -ne 1 ]; then
-		[ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (multiple)";
-	    fi
-	done
-    done
-    egrep "CRIT.*POLICY \[GrowingLogs\] C---------.*${BASE}/a/a/b/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/b/x";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[GrowingLogs\] C---------.*${BASE}/a/a/b/z" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/b/z";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[GrowingLogs\] -----M----.*${BASE}/a/b/z" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/b/z";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[GrowingLogs\] -----M----.*${BASE}/a/a/c/z" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/z";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[GrowingLogs\] C--------S.*${BASE}/a/b/y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/b/y";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/a/a/c/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/x";
-	return 1
-    fi
-    egrep "CRIT.*POLICY ADDED.*${BASE}/a/a/c/foo" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/foo";
-	return 1
-    fi
-    egrep "CRIT.*POLICY ADDED.*033\[1;30m" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/\033[1;30m";
-	return 1
-    fi
-    egrep "WARN.*Weird filename.*033\[1;30m" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/\033[1;30m";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/a/a/c/y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/y";
-	return 1
-    fi
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne 9 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-}
-
-
-TESTPOLICY_4="
-[Attributes]
-dir=${BASE}
-file=${BASE}/a/a/c/x
-[ReadOnly]
-file=${BASE}/a/a/c/y
-[LogFiles]
-dir=${BASE}/a/a/c
-dir=${BASE}/a/b
-"
-
-mod_testdata_4 () {
-    one_sec_sleep
-    echo "foobar" >> "${BASE}/a/a/x"    # Attributes
-    echo "foobar" > "${BASE}/a/a/c/foo" # new within LogFiles
-    echo "foobar" >> "${BASE}/a/a/c/y"  # ReadOnly
-    echo "foobar" >> "${BASE}/a/a/c/x"  # Attributes
-    chmod 0555 "${BASE}/a/a/c/x"        # Attributes
-    chmod 0555 "${BASE}/a/a/c/z"        # LogFiles
-    echo "foobar" >> "${BASE}/a/b/x"    # LogFiles
-    echo ""       >  "${BASE}/a/b/y"    # LogFiles
-    chmod 0555 "${BASE}/a/b/z"          # LogFiles
-    touch "${BASE}/a/a/[1;30m"        # non-printable character in filename
-}
-
-chk_testdata_4 () {
-    for ff in $TDIRS; do
-	#
-	egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (checking)";
-	    return 1
-	fi
-	tmp=`egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE 2>/dev/null | wc -l`
-	if [ $tmp -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (multiple)";
-	fi
-	#
-	for gg in $TFILES; do
-	    egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE >/dev/null 2>&1
-	    if [ $? -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (checking)";
-	    fi
-	    tmp=`egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE 2>/dev/null | wc -l`
-	    if [ $tmp -ne 1 ]; then
-		[ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (multiple)";
-	    fi
-	done
-    done
-    egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/a/a/c/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/x";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[LogFiles\] -----M----.*${BASE}/a/b/z" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/b/z";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[LogFiles\] -----M----.*${BASE}/a/a/c/z" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/z";
-	return 1
-    fi
-    egrep "CRIT.*POLICY ADDED.*${BASE}/a/a/c/foo" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/foo";
-	return 1
-    fi
-    egrep "CRIT.*POLICY ADDED.*033\[1;30m" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/\033[1;30m";
-	return 1
-    fi
-    egrep "WARN.*Weird filename.*033\[1;30m" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/\033[1;30m";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/a/a/c/y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/y";
-	return 1
-    fi
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne 6 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-}
-
-TESTPOLICY_3="
-[Attributes]
-dir=${BASE}
-file=${BASE}/a/a/c/x
-[ReadOnly]
-file=${BASE}/a/a/c/y
-[IgnoreAll]
-dir=${BASE}/a/a/c
-"
-mod_testdata_3 () {
-    one_sec_sleep
-    echo "foobar" > "${BASE}/a/b/foo"   # new within Attributes
-    chmod 0555 "${BASE}/a/b"
-    echo "foobar" > "${BASE}/a/a/c/foo" # new within IgnoreAll
-    echo "foobar" > "${BASE}/a/a/c/y"   # ReadOnly
-    chmod 0555 "${BASE}/a/a/c/x"        # Attributes
-    chmod 0555 "${BASE}/a/a/c/z"        # IgnoreAll
-}
-
-chk_testdata_3 () {
-    for ff in $TDIRS; do
-	#
-	egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (checking)";
-	    return 1
-	fi
-	tmp=`egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE 2>/dev/null | wc -l`
-	if [ $tmp -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (multiple)";
-	fi
-	#
-	for gg in $TFILES; do
-	    egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE >/dev/null 2>&1
-	    if [ $? -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (checking)";
-	    fi
-	    tmp=`egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE 2>/dev/null | wc -l`
-	    if [ $tmp -ne 1 ]; then
-		[ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (multiple)";
-	    fi
-	done
-    done
-    egrep "CRIT.*POLICY ADDED.*${BASE}/a/b/foo" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/b/foo";
-	return 1
-    fi
-    egrep "CRIT.*POLICY ADDED.*${BASE}/a/a/c/foo" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/foo";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/a/b" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/b";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/a/a/c/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/x";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/a/a/c/y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/y";
-	return 1
-    fi
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne 5 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-}
-
-TESTPOLICY_2="
-[ReadOnly]
-dir=${BASE}
-file=${BASE}/a/a/c/x
-[IgnoreAll]
-dir=${BASE}/a/a/c
-"
-mod_testdata_2 () {
-    # mod_testdata_1;
-    one_sec_sleep
-    touch "${BASE}/a/a/x"
-    chmod 0555 "${BASE}/a/a/y"
-    mv "${BASE}/a/b/y" "${BASE}/a/b/yy"; 
-    echo "1 This is a test file" >  "${BASE}/a/b/y";
-    echo "2 This is a test file" >> "${BASE}/a/b/y";
-    echo "4 This is a test file" >> "${BASE}/a/b/z";
-    rm "${BASE}/a/b/yy"; # mv/rm to force new inode
-    rm "${BASE}/a/b/l_y";
-    ln -s "${BASE}/a/b/x" "${BASE}/a/b/l_y";
-    echo "foobar" > "${BASE}/a/c/y"
-    rm "${BASE}/a/a/c/y"
-    echo "foobar" > "${BASE}/a/a/c/foo"
-    chmod 0555 "${BASE}/a/a/c/x"
-    chmod 0555 "${BASE}/a/a/c/z"
-}
-
-chk_testdata_2 () {
-    for ff in $TDIRS; do
-	#
-	egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (checking)";
-	    return 1
-	fi
-	tmp=`egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE 2>/dev/null | wc -l`
-	if [ $tmp -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (multiple)";
-	fi
-	#
-	for gg in $TFILES; do
-	    egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE >/dev/null 2>&1
-	    if [ $? -ne 0 ]; then
-		if [ x"${ff}/${gg}" = x"a/a/c/y" ]; then :; else
-		    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (checking)";
-		    return 1
-		fi
-	    fi
-	done
-    done
-    egrep "CRIT.*POLICY ADDED.*${BASE}/a/a/c/foo" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/foo";
-	return 1
-    fi
-    egrep "CRIT.*POLICY MISSING.*${BASE}/a/a/c/y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/y";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] -----M--T-.*${BASE}/a/a/c/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/c/x";
-	return 1
-    fi
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne 10 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-}
-
-TESTPOLICY_1="
-[Misc]
-RedefReadOnly = +TXT
-[ReadOnly]
-dir=${BASE}
-"
-
-mod_testdata_1 () {
-    one_sec_sleep
-    touch "${BASE}/a/a/x"
-    chmod 0555 "${BASE}/a/a/y"
-    mv "${BASE}/a/b/y" "${BASE}/a/b/yy"; 
-    echo "1 This is a test file" >  "${BASE}/a/b/y";
-    echo "2 This is a test file" >> "${BASE}/a/b/y";
-    echo "4 This is a test file" >> "${BASE}/a/b/z";
-    rm "${BASE}/a/b/yy"; # mv/rm to force new inode
-    rm "${BASE}/a/b/l_y";
-    ln -s "${BASE}/a/b/x" "${BASE}/a/b/l_y";
-    echo "foobar" > "${BASE}/a/c/y"
-    #
-    mv "${BASE}/b/x" "${BASE}/b/xx"; # mv/rm to force new inode 
-    mkdir "${BASE}/b/x"
-    rm "${BASE}/b/xx";
-    #
-    mv "${BASE}/b/y" "${BASE}/b/yy"; # mv/rm to force new inode
-    ln -s  "${BASE}/b/z" "${BASE}/b/y"
-    rm "${BASE}/b/yy";
-    #
-    rm "${BASE}/b/l_x";  echo "1 This is a test file" >  "${BASE}/b/l_x"; 
-}
-
-chk_testdata_1 () {
-    for ff in $TDIRS; do
-	#
-	egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (checking)";
-	    return 1
-	fi
-	tmp=`egrep "Checking.*${BASE}/${ff}(>|\")" $LOGFILE 2>/dev/null | wc -l`
-	if [ $tmp -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (multiple)";
-	    return 1
-	fi
-	#
-	for gg in $TFILES; do
-	    egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE >/dev/null 2>&1
-	    if [ $? -ne 0 ]; then
-		if [ "${BASE}/${ff}" != "${BASE}/b" ]; then
-		    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (checksum)";
-		    return 1
-		fi
-	    fi
-	    tmp=`egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE 2>/dev/null | wc -l`
-	    if [ $tmp -ne 1 ]; then
-		if [ "${BASE}/${ff}" != "${BASE}/b" ]; then
-		    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (multiple)";
-		    return 1
-		fi
-	    fi
-	done
-    done
-    #
-    #
-    #
-    egrep "CRIT.*POLICY \[ReadOnly\] ----H---T-.*${BASE}/b" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/b";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] CL-I-M--TS.*${BASE}/b/y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/b/y";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] CL-.-M--TS.*${BASE}/b/l_x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/b/l_x";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] C--IHM--TS.*${BASE}/b/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/b/x";
-	return 1
-    fi
-    #
-    #
-    #
-    egrep "CRIT.*POLICY \[ReadOnly\] --------T-.*${BASE}/a/a/x" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/x";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] -----M--T-.*${BASE}/a/a/y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/y";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] ---I----T-.*${BASE}/a/b/y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/b/y";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] -L-I----T-.*${BASE}/a/b/l_y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/b/l_y";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] --------T-.*${BASE}/a/b" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/b";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/a/b/z" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/b/z";
-	return 1
-    fi
-    egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/a/c/y" $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/c/y";
-	return 1
-    fi
-    tmp=`grep CRIT $LOGFILE | wc -l`
-    if [ $tmp -ne 11 ]; then
-	[ -z "$verbose" ] || log_msg_fail "policy count";
-	return 1
-    fi
-    for ff in x y z; do
-	./samhain --list-file "${BASE}/a/a/${ff}" -d "$PW_DIR/.samhain_file" > "$PW_DIR/.samhain_tmp"
-	diff "$PW_DIR/.samhain_tmp" "${BASE}/a/a/${ff}" >/dev/null
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "diff $PW_DIR/.samhain_tmp ${BASE}/a/a/${ff}"
-	    return 1
-	fi
-    done
-
-    return 0
-}
-
-
-##############################################################
-#
-# Common subroutines
-#
-
-mkconfig_misc ()
-{
-    test -f "${RCFILE}" || touch "${RCFILE}"
-    cat >> "${RCFILE}" <<End-of-data
-[Misc]
-Daemon=no
-SetFilecheckTime=60
-TrustedUser=uucp,fax,fnet
-SetRecursionLevel=10
-SetLoopTime=30
-ReportFullDetail = no
-ChecksumTest=check
-
-End-of-data
-}
-
-mkconfig_log ()
-{
-    test -f "${RCFILE}" || touch "${RCFILE}"
-    cat >> "${RCFILE}" <<End-of-data
-[Log]
-MailSeverity=none
-LogSeverity=warn
-SyslogSeverity=none
-PrintSeverity=info
-MailSeverity=none
-#Restrict to certain classes of messages
-#LogClass=RUN
-#PreludeSeverity=err
-#ExportSeverity=none
-
-End-of-data
-}
-
-mkconfig_sev ()
-{
-    test -f "${RCFILE}" || touch "${RCFILE}"
-    cat >> "${RCFILE}" <<End-of-data
-[EventSeverity]
-SeverityUser0=crit
-SeverityUser1=crit
-SeverityReadOnly=crit
-SeverityLogFiles=crit
-SeverityGrowingLogs=crit
-SeverityIgnoreNone=crit
-SeverityAttributes=crit
-SeverityIgnoreAll=crit
-SeverityFiles=err
-SeverityDirs=err
-SeverityNames=warn
-
-End-of-data
-}
-
-prep_testpolicy ()
-{
-    test -f "${RCFILE}" || touch "${RCFILE}"
-    eval echo '"$'"TESTPOLICY_$1"'"' >>"${RCFILE}"
-}
-
-prep_init ()
-{
-    rm -f ./.samhain_file
-    rm -f "${LOGFILE}"
-    rm -f ./.samhain_lock
-
-    rm -f "${RCFILE}"
-    mkconfig_sev
-    mkconfig_log
-    mkconfig_misc
-}
-
-run_init ()
-{
-    rm -f test_log_valgrind
-
-    ${VALGRIND} ./samhain -t init -p none 2>>test_log_valgrind
-
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "init...";
+MAKE=`which gmake`
+if test "x$?" = x1 ; then
+    MAKE="make -s"
+else
+    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$MAKE" = x; then
+	MAKE="make -s"
+    elif test "x$MAKE" = xno; then
+	MAKE="make -s"
     else
-	[ -z "$quiet" ]   && log_msg_fail  "init...";
-	return 1
-    fi
-}
-
-run_check ()
-{
-    if [ "x$1" = "x"  ]; then
-	logsev=debug
-    else
-	logsev=$1
-    fi
-    ${VALGRIND} ./samhain -t check -p none -l $logsev 2>>test_log_valgrind
- 
-    if test x$? = x0; then
-
-	./samhain -j -L $LOGFILE >"${LOGFILE}.tmp" && mv "${LOGFILE}.tmp" "${LOGFILE}"
-
-	if [ $? -ne 0 ]; then
-	    [ -z "$quiet" ]   && log_msg_fail  "mv logfile...";
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "check...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "check...";
-	return 1
-    fi
-}
-
-run_update ()
-{
-    ${VALGRIND} ./samhain -t update -p none -l debug 2>>test_log_valgrind
-
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "update...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "update...";
-	return 1
-    fi
-}
-
-run_check_after_update ()
-{
-    rm -rf $LOGFILE
-
-    ${VALGRIND} ./samhain -t check -p none -l debug 2>>test_log_valgrind
-
-    if test x$? = x0; then
-	#
-	tmp=`./samhain -j -L $LOGFILE | grep CRIT | wc -l`
-	if [ $tmp -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "update not successful(?)";
-	    return 1
-	fi
-	#
-	# wtmp may not be readable
-	#
-	tmp=`./samhain -j -L $LOGFILE | grep ERR | grep -v wtmp | wc -l`
-	if [ $tmp -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "errors during check";
-	    return 1
-	fi
-	#
-	[ -z "$VALGRIND" ] || {
-	    tmp=`cat test_log_valgrind 2>/dev/null | wc -l`;
-	    if [ $tmp -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "valgrind reports errors";
-		cat test_log_valgrind
-		return 1;
-	    fi;
-	}
-	#
-	[ -z "$verbose" ] || log_msg_ok    "check(2)...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "check(2)...";
-	return 1
-    fi
-}
-
-prep_testdata ()
-{
-    if test -d "$BASE"; then
-	if [ -d "${BASE}" ]; then
-	    chmod -f -R 0700 "${BASE}" || {
-		[ -z "$quiet" ] &&   log_msg_fail "chmod -f -R 0700 ${BASE}"; 
-		return 1;
-	    }
+	if test "x$MAKE" = "xwhich:"; then
+		MAKE="make -s"
+	else
+		MAKE="gmake -s"
+		gmake -v >/dev/null 2>&1 || MAKE="make -s"
 	fi
     fi
+fi
+echo MAKE is $MAKE
+echo
 
-    rm -rf "${BASE}" || {
-	[ -z "$quiet" ] &&   log_msg_fail "rm -rf ${BASE}"; 
-	return 1;
-    }
+# --with-database=mysql 
+# --enable-debug
+# [egd|unix|dev|default]
 
-    mkdir "${BASE}" || {
-	[ -z "$quiet" ] &&   log_msg_fail "mkdir ${BASE}"; 
-	return 1;
-    }
-
-    echo "${BASE}" > ./tmp_list_file
-
-    for ff in $TDIRS; do
-	mkdir "${BASE}/${ff}" || { 
-	    [ -z "$quiet" ] &&   log_msg_fail "mkdir ${BASE}/${ff}"; 
-	    return 1;
-	}
-	echo "${BASE}/${ff}" >> ./tmp_list_file
-	chmod 0755 "${BASE}/${ff}"
-	for gg in $TFILES; do
-	    echo "1 This is a test file" > "${BASE}/${ff}/${gg}"
-	    chmod 0644 "${BASE}/${ff}/${gg}"
-	    echo "${BASE}/${ff}/${gg}"  >> ./tmp_list_file
-	    ln -s "${BASE}/${ff}/${gg}" "${BASE}/${ff}/l_${gg}"
-	    echo "${BASE}/${ff}/l_${gg}"  >> ./tmp_list_file
-	done
-	echo "2 This is a test file" >> "${BASE}/${ff}/y"
-	echo "2 This is a test file" >> "${BASE}/${ff}/z"
-	echo "3 This is a test file" >> "${BASE}/${ff}/z"
-    done
-}
-
-check_err ()
+testrun1 ()
 {
-    if [ $1 -ne 0 ]; then
-	log_fail ${2} ${MAXTEST};
-	return 1
-    fi
-    return 0
-}
- 
-testrun_internal ()
-{
-	[ -z "$verbose" ] || echo Working directory: $PW_DIR
-	[ -z "$verbose" ] || { echo MAKE is $MAKE; echo; }
-
 	#
 	# test standalone compilation
 	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
+	echo "${S}Building standalone agent${E}"; echo;
+	#
+	if test -r "Makefile"; then
+		$MAKE distclean
+	fi
+	#
+	# --enable-login-watch --enable-xml-log 
+	# --enable-debug --enable-suidcheck --with-prelude
 
-	if test -r "Makefile"; then
-		$MAKE distclean >/dev/null 
-	fi
+	${TOP_SRCDIR}/configure --quiet $TRUST --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/test/testrc_1 --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file --enable-debug
+# --with-prelude --enable-micro-stealth=128
+# --with-prelude
 
-	${TOP_SRCDIR}/configure ${BUILDOPTS} 
+# --with-kcheck=/boot/System.map 
+
+# --with-prelude --enable-xml-log
+
+# --with-kcheck=/boot/System.map-2.4.20-24.9
+# --with-kcheck=/boot/System.map-deb-2.4.18-686 
+
+# --enable-stealth=192
+# --with-console=$PW_DIR/dlog_file
 
 	#
 	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  >/dev/null 2>>test_log
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
 		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
+		    echo "$MAKE completed, exit status $?"; echo;
 		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
 		fi
 
 	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
 	fi
 
-	[ -z "$verbose" ] || { echo; echo "${S}Running test suite${E}"; echo; }
+	rm -f ./.samhain_file
+	rm -f ./.samhain_log
+	rm -f ./.samhain_lock
 
-	tcount=1
-	POLICY=`eval echo '"$'"TESTPOLICY_$tcount"'"'`
+	./samhain -t init
 
-	until [ ${tcount} -gt ${MAXTEST_3} ]
-	do
-	  prep_init
-	  check_err $? ${tcount}; errval=$?
-	  if [ $errval -eq 0 ]; then
-	      prep_testdata
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      prep_testpolicy   ${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      run_init
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      eval mod_testdata_${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      run_check
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      eval chk_testdata_${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $testrun1_setup -eq 0 ]; then
-	      if [ $errval -eq 0 ]; then
-		  run_update
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	      if [ $errval -eq 0 ]; then
-		  run_check_after_update
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	  fi
-	  #
-	  if [ $errval -eq 0 ]; then
-	      [ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST};
-	  fi
-	  #
-	  let "tcount = tcount + 1" >/dev/null
-	  #
-	  if [ $tcount -eq 10 ]; then
-	      if [ -z "$doall" ]; then
-		  log_skip 10 $MAXTEST 'ACL/SELinux test (or use --really-all)'
-		  log_skip 11 $MAXTEST 'ACL/SELinux test (or use --really-all)'
-		  let "tcount = tcount + 2" >/dev/null
-	      else
-		  # 'id -u' is posix
-		  #
-		  if test -f /usr/xpg4/bin/id
-		  then
-		      my_uid=`/usr/xpg4/bin/id -u`
-		  else
-		      my_uid=`id -u`
-		  fi
-		  #
-		  if [ ${my_uid} -ne 0 ]; then
-		      log_skip 10 $MAXTEST 'ACL/SELinux test (you are not root)'
-		      log_skip 11 $MAXTEST 'ACL/SELinux test (you are not root)'
-		      let "tcount = tcount + 2" >/dev/null
-		  else
-
-		      SETFATTR=`find_path setfattr`
-		      if [ -z "$SETFATTR" ]; then
-			  log_skip 10 $MAXTEST 'ACL/SELinux test (setfattr not in path)'
-			  log_skip 11 $MAXTEST 'ACL/SELinux test (setfattr not in path)'
-			  let "tcount = tcount + 2" >/dev/null
-		      fi
-		  fi
-	      fi
-	  fi
-	  #
-	  POLICY=`eval echo '"$'"TESTPOLICY_$tcount"'"'`
-	done
+	if test x$? = x0; then
+		echo
+		echo "${S}init completed${E}"
+		echo
+		./samhain -t check 
+		if test x$? = x0; then
+		    echo "${S}check completed${E}"
+		else
+		    echo "${S}ERROR:${E} -- check -- failed, exit status $?"
+		    echo
+		    exit
+		fi
+	else
+		echo "${S}ERROR:${E} -- init -- failed, exit status $?"; echo;
+		exit
+	fi
 	    
-	return 0
-}
-
-testrun1 ()
-{
-    log_start "RUN STANDALONE"
-    testrun_internal
-    log_end "RUN STANDALONE"
-    return 0
 }
 
 
 
+	testrun1
+
+
+echo; echo "${S}__ END TEST RUN STANDALONE __${E}"; echo;
+
+exit
+
Index: trunk/test/testrun_1a.sh
===================================================================
--- trunk/test/testrun_1a.sh	(revision 591)
+++ trunk/test/testrun_1a.sh	(revision 1)
@@ -1,160 +1,111 @@
 #! /bin/sh
 
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
 
-PREBUILDOPTS="--quiet $TRUST --enable-debug --enable-static --enable-xml-log --enable-login-watch --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"
-export PREBUILDOPTS
+# The following two are the ANSI sequences for start and end embolden
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
 
-MAXTEST=1; export MAXTEST
+PW_DIR=`pwd`
 
-testrun_stealth ()
-{
-    tcount=1
+if test x$UID != x; then
+  TRUST="--with-trusted=0,2,$UID"
+else
+  TRUST="--with-trusted=0,2"
+fi
 
-    if test -r "Makefile"; then
-	$MAKE distclean >/dev/null 
-    fi
-    
-    ${TOP_SRCDIR}/configure ${BUILDOPTS} 
-    
-    if test x$? = x0; then
-	[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-	$MAKE  >/dev/null 2>>test_log
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok "make..."; 
+echo; echo "${S}__ STARTING TEST RUN STEALTH STANDALONE __${E}"; echo;
+echo Working directory: $PW_DIR
+
+MAKE=`which gmake`
+if test "x$?" = x1 ; then
+    MAKE="make -s"
+else
+    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$MAKE" = x; then
+	MAKE="make -s"
+    elif test "x$MAKE" = xno; then
+	MAKE="make -s"
+    else
+	if test "x$MAKE" = "xwhich:"; then
+		MAKE="make -s"
 	else
-	    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-	    return 1
-	fi
-	
-    else
-	[ -z "$quiet" ] &&       log_msg_fail "configure...";
-	return 1
-    fi
-
-    CONVERT=`find_path convert`
-    if [ x"$CONVERT" = x ]; then
-	[ -z "$verbose" ] || log_msg_fail "ImageMagick convert not found";
-	return 1
-    fi
-    "$CONVERT" --help | grep  ImageMagick >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Convert utility is not ImageMagick convert";
-	return 1
-    fi
-    "${CONVERT}" +compress stealth_template.jpg stealth_template.ps
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Converting stealth_template.jpg failed";
-	return 1
-    fi
-    
-    $MAKE samhain_stealth >/dev/null 2>>test_log
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "make samhain_stealth";
-	return 1
-    fi
-    capacity=`./samhain_stealth -i stealth_template.ps | awk '{ print $7 }'`
-
-    prep_init
-    check_err $? ${tcount}; errval=$?
-    if [ $errval -eq 0 ]; then
-	prep_testdata
-	check_err $? ${tcount}; errval=$?
-    fi
-    if [ $errval -eq 0 ]; then
-	prep_testpolicy   1
-	check_err $? ${tcount}; errval=$?
-    fi
-
-    if [ $errval -eq 0 ]; then
-	fill=`cat "${RCFILE}" | wc -c`
-	check_err $? ${tcount}; errval=$?
-    fi
-    if [ $errval -eq 0 ]; then
-	let "capacity = capacity - fill" >/dev/null
-	let "capacity = capacity - 100" >/dev/null
-	until [ "$capacity" -le 0 ]
-	  do
-	  echo "###############################" >>"${RCFILE}"
-	  let "capacity = capacity - 32" >/dev/null
-	done
-
-	./samhain_stealth -s stealth_template.ps "${RCFILE}" >/dev/null
-	check_err $? ${tcount}; errval=$?
-    fi
-    if [ $errval -eq 0 ]; then
-	cp stealth_template.ps "${RCFILE}"
-	check_err $? ${tcount}; errval=$?
-    fi
-
-    if [ $errval -eq 0 ]; then
-	run_init
-	check_err $? ${tcount}; errval=$?
-    fi
-    if [ $errval -eq 0 ]; then
-	eval mod_testdata_1
-	check_err $? ${tcount}; errval=$?
-    fi
-    if [ $errval -eq 0 ]; then
-	run_check
-	check_err $? ${tcount}; errval=$?
-    fi
-    if [ $errval -eq 0 ]; then
-	eval chk_testdata_1
-	check_err $? ${tcount}; errval=$?
-    fi
-    if [ $testrun1_setup -eq 0 ]; then
-	if [ $errval -eq 0 ]; then
-	    run_update
-	    check_err $? ${tcount}; errval=$?
-	fi
-	if [ $errval -eq 0 ]; then
-	    run_check_after_update
-	    check_err $? ${tcount}; errval=$?
+		MAKE="gmake -s"
+		gmake -v >/dev/null 2>&1 || MAKE="make -s"
 	fi
     fi
+fi
 
-    if [ $errval -eq 0 ]; then
-	[ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST};
-    fi
-    return 0
+echo MAKE is $MAKE
+echo
+
+
+testrun1 ()
+{
+	#
+	# test standalone compilation
+	#
+	echo "${S}Building standalone agent${E}"; echo;
+	#
+	if test -r "Makefile"; then
+		$MAKE distclean
+	fi
+	#
+	${TOP_SRCDIR}/configure --quiet $TRUST --enable-debug --enable-xml-log --enable-micro-stealth=137 --enable-nocl=foo --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/test/testrc_1   --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file 
+	#
+	if test x$? = x0; then
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
+		if test x$? = x0; then
+		    echo "$MAKE completed, exit status $?"; echo;
+		else
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
+		fi
+
+	else
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
+	fi
+
+	rm -f ./.samhain_file
+	rm -f ./.samhain_log
+	rm -f ./.samhain_lock
+
+	echo '-t init' | ./samhain foo
+
+	if test x$? = x0; then
+		echo
+		echo "${S}init completed${E}"
+		echo
+		echo '-t check' | ./samhain foo
+		if test x$? = x0; then
+		    echo "${S}check completed${E}"
+		else
+		    echo "${S}ERROR:${E} -- check -- failed, exit status $?"
+		    echo
+		    exit
+		fi
+	else
+		echo "${S}ERROR:${E} -- init -- failed, exit status $?"; echo;
+		exit
+	fi
+	    
 }
 
-testrun1a ()
-{
-    log_start "RUN STANDALONE W/STEALTH"
-    #
-    # micro-stealth
-    #
-    #BUILDOPTS="$PREBUILDOPTS --enable-micro-stealth=137"; export BUILDOPTS
-    #testrun_internal
 
-    CONVERT=`find_path convert`
-    if [ x"$CONVERT" = x ]; then
-	log_skip 1 ${MAXTEST} "ImageMagick convert not found";
-	return 0
-    fi
-    BUILDOPTS="$PREBUILDOPTS --enable-stealth=137"; export BUILDOPTS
-    testrun_stealth
-    check_err $? ${tcount};
-    log_end "RUN STANDALONE W/STEALTH"
-    return 0
-}
 
+	testrun1
+
+
+echo; echo "${S}__ END TEST RUN STANDALONE __${E}"; echo;
+
+exit
+
Index: trunk/test/testrun_1b.sh
===================================================================
--- trunk/test/testrun_1b.sh	(revision 591)
+++ trunk/test/testrun_1b.sh	(revision 1)
@@ -1,136 +1,113 @@
 #! /bin/sh
 
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
 
-MAXTEST=7; export MAXTEST
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
+# The following two are the ANSI sequences for start and end embolden
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
 
-testrun1b_modrc ()
+PW_DIR=`pwd`
+
+if test x$UID != x; then
+  TRUST="--with-trusted=0,2,$UID"
+else
+  TRUST="--with-trusted=0,2"
+fi
+
+echo; echo "${S}__ STARTING TEST RUN STEALTH W/GPG STANDALONE __${E}"; echo;
+echo Working directory: $PW_DIR
+
+MAKE=`which gmake`
+if test "x$?" = x1 ; then
+    MAKE="make -s"
+else
+    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$MAKE" = x; then
+	MAKE="make -s"
+    elif test "x$MAKE" = xno; then
+	MAKE="make -s"
+    else
+	if test "x$MAKE" = "xwhich:"; then
+		MAKE="make -s"
+	else
+		MAKE="gmake -s"
+		gmake -v >/dev/null 2>&1 || MAKE="make -s"
+	fi
+    fi
+fi
+echo MAKE is $MAKE
+
+# $GPG_PATH _must_ be an absolute path
+# 
+if test x${GPG_PATH} = x; then
+    GPG_PATH=`which gpg | sed -e "s%\([a-z:]\) .*%\1%g"` 
+fi
+
+if test x${GPG_PATH} = x; then
+    echo "ERROR: gpg (GnuPG) not found"
+    exit
+else
+    GPG_OK=`echo ${GPG_PATH} | sed -e "s%\(/.*\)%OK%g"`
+    if test x${GPG_OK} = xOK; then
+	echo "GPG_PATH is ${GPG_PATH}"
+    else
+	echo "ERROR: GPG_PATH (${GPG_PATH}) is _not_ an absolute path."
+	echo 
+	echo "  Apparently the command 'which gpg' did not yield an absolute path."
+	echo "  You can fix the problem by setting the environment variable GPG_PATH"
+	echo "  to the absolute path to gpg (GnuPG) and start the test again."
+	exit
+    fi
+fi
+
+echo
+
+testrun1 ()
 {
-        ORIGINAL="\[EOF\]"
-        REPLACEMENT="\[PortCheck\]"
-        ex -s $RCFILE <<EOF
-%s/$ORIGINAL/$REPLACEMENT/g
-wq
-EOF
-
-        echo "PortCheckActive = yes" >>"$RCFILE"
-        echo "PortCheckInterface = 127.0.0.1" >>"$RCFILE"
-}
-
-testrun1b_internal ()
-{
-	BUILDOPTS="$1"
 	#
 	# test standalone compilation
 	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
+	echo "${S}Building standalone agent${E}"; echo;
 	#
 	if test -r "Makefile"; then
-		$MAKE distclean >/dev/null >&1
+		$MAKE distclean
 	fi
 	#
-	# Bootstrapping
+	GPG_HASH=`${GPG_PATH} --load-extension tiger --print-md TIGER192 ${GPG_PATH}`
 	#
-	${TOP_SRCDIR}/configure >/dev/null 2>/dev/null
+	echo GPG_HASH is ${GPG_HASH}
+	#
+	${TOP_SRCDIR}/configure --quiet $TRUST --enable-debug --with-gpg=${GPG_PATH} --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/testrc_1.signed  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file
+	#
+	# --with-prelude --enable-xml-log 
+	#  --with-checksum="${GPG_HASH}"
+	#
 	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure (bootstrap)..."; 
-		$MAKE  > /dev/null 2>&1
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
 		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make (bootstrap)..."; 
+		    echo "$MAKE completed, exit status $?"; echo;
 		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make (bootstrap)..."; 
-		    return 1
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
 		fi
 
 	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure (bootstrap)...";
-		return 1
-	fi
-	#
-	#
-	${TOP_SRCDIR}/configure ${BUILDOPTS} 2>/dev/null
-	#
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  > /dev/null 2>&1
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
 	fi
 
-	SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' ${SCRIPTDIR}/test.sh`
-
-	tail -n "+$SKIP" ${SCRIPTDIR}/test.sh >/dev/null 2>&1
-	if [ $? -eq 0 ]; then
-	    tail -n "+$SKIP" ${SCRIPTDIR}/test.sh | gunzip -c - 2>/dev/null | tar xf - &&  \
-		mv "./testrc.gpg.asc" "$RCFILE"
-	else
-	    tail "+$SKIP" ${SCRIPTDIR}/test.sh | gunzip -c - 2>/dev/null | tar xf - &&  \
-		mv "./testrc.gpg.asc" "$RCFILE"
-	fi
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "extract gpg signed files...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "extract gpg signed files...";
-	    return 1
-	fi
-
-	if test "x$2" = "x"; then
-	    :
-	else
-	    CONVERT="$2"
-	    if test -f "${TOP_SRCDIR}/stealth_template.jpg"; then
-		[ -z "$verbose" ] || log_msg_ok "convert..."
-		"${CONVERT}" +compress "${TOP_SRCDIR}/stealth_template.jpg" stealth_template.ps >/dev/null
-	    else
-		[ -z "$quiet" ]   && log_msg_fail  "cannot find file stealth_template.jpg"
-		return 1
-	    fi
-	    if [ $? -ne 0 ]; then
-		[ -z "$quiet" ]   && log_msg_fail  "${CONVERT} +compress ${TOP_SRCDIR}/stealth_template.jpg stealth_template.ps";
-		return 1
-	    fi
-
-	    [ -z "$verbose" ] || log_msg_ok "hide..."
-	    ./samhain_stealth -s stealth_template.ps "$RCFILE" >/dev/null
-	    if [ $? -ne 0 ]; then
-		[ -z "$quiet" ]   && log_msg_fail  "${CONVERT} +compress ${TOP_SRCDIR}/stealth_template.jpg stealth_template.ps";
-		return 1
-	    fi
-
-	    mv -f stealth_template.ps "$RCFILE"
-	    if [ $? -ne 0 ]; then
-		[ -z "$quiet" ]   && log_msg_fail  "mv -f stealth_template.ps $RCFILE";
-		return 1
-	    fi
-
-	fi
+	cp $PW_DIR/test/testrc_1 $PW_DIR/testrc_1.signed
+	echo "--- You need to sign the config file testrc_1.signed now ---"
+	echo
+	${GPG_PATH} -a --clearsign $PW_DIR/testrc_1.signed
+	mv $PW_DIR/testrc_1.signed.asc $PW_DIR/testrc_1.signed
 
 	rm -f ./.samhain_file
@@ -138,331 +115,36 @@
 	rm -f ./.samhain_lock
 
-	./samhain -t init -p none -l info
+	./samhain -t init
 
 	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "init...";
+
+		echo
+		echo "--- You need to sign the database .samhain_file now ---"
+		echo
+		${GPG_PATH} -a --clearsign --not-dash-escaped $PW_DIR/.samhain_file
+		mv $PW_DIR/.samhain_file.asc $PW_DIR/.samhain_file
+
+		./samhain -t check
+		if test x$? = x0; then
+		    echo "${S}check completed${E}"
+		else
+		    echo "${S}ERROR:${E} -- check -- failed, exit status $?"
+		    echo
+		    exit
+		fi
 	else
-	    [ -z "$quiet" ]   && log_msg_fail  "init...";
-	    return 1
+		echo "${S}ERROR:${E} -- init -- failed, exit status $?"; echo;
+		exit
 	fi
-
-	mv $PW_DIR/.samhain_file.asc $PW_DIR/.samhain_file
+	    
 }
 
-testrun1b_nogpg ()
-{
-	BUILDOPTS="$1"
-	#
-	# test standalone compilation
-	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
-	#
-	if test -r "Makefile"; then
-		$MAKE distclean >/dev/null >&1
-	fi
-
-	${TOP_SRCDIR}/configure ${BUILDOPTS} 2>/dev/null 
-        #
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  > /dev/null 2>&1
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	rm -f ./.samhain_file
-	rm -f ./.samhain_log
-	rm -f ./.samhain_lock
-
-	cp "${SCRIPTDIR}/testrc_1" "${RCFILE}"
-
-	if test "x$2" = "xmodrc"; then
-	    [ -z "$verbose" ] || log_msg_ok    "mod rc...";
-	    testrun1b_modrc
-	fi
-
-	./samhain -t init -p none -l info
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "init...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "init...";
-	    return 1
-	fi
-
-}
-
-do_test_1b () {
-
-    ./samhain -t check -p none -l info
-    
-    if test x$? = x0; then
-	./samhain -j -L $LOGFILE >"${LOGFILE}.tmp" && mv "${LOGFILE}.tmp" "${LOGFILE}"
-	if [ $? -ne 0 ]; then
-	    [ -z "$quiet" ]   && log_msg_fail  "mv logfile...";
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "check...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "check...";
-	return 1
-    fi
-    #
-    tmp=`egrep "Checking.*/etc(>|\")" $LOGFILE 2>/dev/null | wc -l`
-    if [ $tmp -ne 2 ]; then
-	[ -z "$verbose" ] || log_msg_fail "/etc";
-	return 1
-    fi
-    tmp=`egrep "Checking.*(>|\")" $LOGFILE 2>/dev/null | wc -l`
-    if [ $tmp -ne 10 ]; then
-	[ -z "$verbose" ] || log_msg_fail "checking";
-	return 1
-    fi
-    egrep "ADDED" $LOGFILE >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "init was incomplete";
-	return 1
-    fi
-    #
-    return 0
-}
-
-do_test_1b_2 () {
-
-    #rm -f $PW_DIR/test_log_prelude
-    test_log_prelude="/var/log/prelude/prelude-text.log"
-    echo -n >"${test_log_prelude}"
-    
-    #[ -z "$verbose" ] || { echo " starting prelude-manager.."; echo " ($PM --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 &)"; }
-    #"$PM" --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 &
-    #PID=$!
-
-    #five_sec_sleep
-
-    ./samhain -t check -p none -l info --set-prelude-severity=info --prelude --server-addr 127.0.0.1:5500 >/dev/null
-    
-    if test x$? = x0; then
-	./samhain -j -L $LOGFILE >"${LOGFILE}.tmp" && mv "${LOGFILE}.tmp" "${LOGFILE}"
-	if [ $? -ne 0 ]; then
-	    [ -z "$quiet" ]   && log_msg_fail  "mv logfile...";
-	    kill $PID
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "check...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "check...";
-	#kill $PID
-	return 1
-    fi
-    #
-    tmp=`egrep 'File original:.*name=etc.*path=/etc' ${test_log_prelude} 2>/dev/null | wc -l`
-    if [ $tmp -lt 1 ]; then
-	[ -z "$verbose" ] || log_msg_fail "/etc";
-	#kill $PID
-	return 1
-    fi
-    tmp=`egrep 'Classification text: Checking' ${test_log_prelude} 2>/dev/null | wc -l`
-    if [ $tmp -lt 1 ]; then
-	[ -z "$verbose" ] || log_msg_fail "checking";
-	#kill $PID
-	return 1
-    fi
-    #
-    if test "x$2" = "xmodrc"; then
-	tmp=`egrep 'Classification text: Service opened' ${test_log_prelude} 2>/dev/null | wc -l`
-	if [ $tmp -lt 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "service";
-	    #kill $PID
-	    return 1
-	fi
-	tmp=`egrep 'Service: port=5500' ${test_log_prelude} 2>/dev/null | wc -l`
-	if [ $tmp -lt 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "port 5500";
-	    #kill $PID
-	    return 1
-	fi
-    fi
-    #
-    #kill $PID
-    return 0
-}
-
-testrun1b ()
-{
-    log_start "RUN STANDALONE W/STEALTH W/GPG"
-    GPG=`find_path gpg`
-    if [ -z "$GPG" ]; then
-	log_skip 1 $MAXTEST 'gpg not found in $PATH'
-	log_skip 2 $MAXTEST 'gpg not found in $PATH'
-	log_skip 3 $MAXTEST 'gpg not found in $PATH'
-	log_skip 4 $MAXTEST 'gpg not found in $PATH'
-	log_skip 5 $MAXTEST 'gpg not found in $PATH'
-	log_skip 6 $MAXTEST 'gpg not found in $PATH'
-	log_skip 7 $MAXTEST 'gpg not found in $PATH'
-    else
-	eval "$GPG" --list-keys 0F571F6C >/dev/null 2>/dev/null
-	if [ $? -ne 0 ]; then
-	    log_skip 1 $MAXTEST 'public PGP key 0x0F571F6C not present'
-	    log_skip 2 $MAXTEST 'public PGP key 0x0F571F6C not present'
-	    log_skip 3 $MAXTEST 'public PGP key 0x0F571F6C not present'
-	    log_skip 4 $MAXTEST 'public PGP key 0x0F571F6C not present'
-	    log_skip 5 $MAXTEST 'public PGP key 0x0F571F6C not present'
-	    log_skip 6 $MAXTEST 'public PGP key 0x0F571F6C not present'
-	    log_skip 7 $MAXTEST 'public PGP key 0x0F571F6C not present'
-	else
-	    #
-	    # -------------  first test -------------
-	    #
-	    BUILDOPTS="--quiet $TRUST --enable-debug --with-gpg=${GPG} --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
-	    testrun1b_internal "${BUILDOPTS}" 
-	    do_test_1b
-	    if [ $? -eq 0 ]; then
-		log_ok   1 $MAXTEST 'gpg signed config/database files'
-	    else
-		log_fail 1 $MAXTEST 'gpg signed config/database files'
-	    fi
 
 
-	    #
-	    # -------------  second test -------------
-	    #
-	    BUILDOPTS="--quiet $TRUST --enable-debug --with-gpg=${GPG} --with-checksum --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
-	    testrun1b_internal "${BUILDOPTS}" 
-	    do_test_1b
-	    if [ $? -eq 0 ]; then
-		log_ok   2 $MAXTEST 'gpg signed config/database files'
-	    else
-		log_fail 2 $MAXTEST 'gpg signed config/database files'
-	    fi
+	testrun1
 
 
-	    #
-	    # -------------  third test -------------
-	    #
-	    BUILDOPTS="--quiet $TRUST --enable-debug --with-gpg=${GPG} --with-checksum --with-fp=EF6CEF54701A0AFDB86AF4C31AAD26C80F571F6C --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
-	    testrun1b_internal "${BUILDOPTS}" 
-	    do_test_1b
-	    if [ $? -eq 0 ]; then
-		log_ok   3 $MAXTEST 'gpg signed config/database files'
-	    else
-		log_fail 3 $MAXTEST 'gpg signed config/database files'
-	    fi
+echo; echo "${S}__ END TEST RUN STANDALONE __${E}"; echo;
 
+exit
 
-	    #
-	    # -------------  fourth test -------------
-	    #
-	    PRECONV=`find_path convert`
-	    "${PRECONV}" --help | grep  ImageMagick >/dev/null 2>&1 && \
- 		CONVERT="${PRECONV}"
-
-	    if [ -z "$CONVERT" ]; then
-		log_skip 2 $MAXTEST 'ImageMagick convert not found in $PATH'
-	    else
-		BUILDOPTS="--quiet $TRUST --enable-debug --with-gpg=${GPG} --with-checksum --enable-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
-		testrun1b_internal "${BUILDOPTS}" "$CONVERT"
-		do_test_1b
-		if [ $? -eq 0 ]; then
-		    log_ok   4 $MAXTEST 'gpg signed config/database files'
-		else
-		    log_fail 4 $MAXTEST 'gpg signed config/database files'
-		fi
-	    fi
-
-
-	    #
-	    # -------------  fifth test -------------
-	    #
-	    if ! test -d /var/run/prelude-manager
-	    then
-		    [ -z "$verbose" ] || log_msg_ok    "create /var/run/prelude-manager...";
-		    sudo mkdir /var/run/prelude-manager
-		    sudo chown prelude:rainer /var/run/prelude-manager
-		    sudo chmod 770 /var/run/prelude-manager
-	    fi
-	    #
-	    PM=`find_path prelude-manager`
-	    if [ -z "$PM" ]; then
-		log_skip 5 $MAXTEST 'prelude-manager not found in $PATH'
-	    elif [ -z "$doall" ]; then
-		log_skip 5 $MAXTEST 'logging to prelude (or use --really-all)'
-	    else
-		BUILDOPTS="--quiet $TRUST --enable-debug --with-prelude --with-gpg=${GPG} --with-checksum --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
-		testrun1b_internal "${BUILDOPTS} CFLAGS=-DSH_NOFAILOVER=1"
-		do_test_1b_2
-		if [ $? -eq 0 ]; then
-		    log_ok   5 $MAXTEST 'logging to prelude'
-		else
-		    log_fail 5 $MAXTEST 'logging to prelude'
-		fi
-	    fi
-
-	    #
-	    # -------------  sixth test -------------
-	    #
-	    if ! test -d /var/run/prelude-manager
-	    then
-		    [ -z "$verbose" ] || log_msg_ok    "create /var/run/prelude-manager...";
-		    sudo mkdir /var/run/prelude-manager
-		    sudo chown prelude:rainer /var/run/prelude-manager
-		    sudo chmod 770 /var/run/prelude-manager
-	    fi
-	    #
-	    PM=`find_path prelude-manager`
-	    if [ -z "$PM" ]; then
-		log_skip 6 $MAXTEST 'prelude-manager not found in $PATH'
-	    elif [ -z "$doall" ]; then
-		log_skip 6 $MAXTEST 'logging to prelude (or use --really-all)'
-	    else
-		BUILDOPTS="--quiet $TRUST --with-prelude --enable-login-watch --enable-mounts-check --enable-process-check --enable-port-check --enable-suidcheck --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
-		testrun1b_nogpg "${BUILDOPTS} CFLAGS=-DSH_NOFAILOVER=1"
-		do_test_1b_2
-		if [ $? -eq 0 ]; then
-		    log_ok   6 $MAXTEST 'logging to prelude'
-		else
-		    log_fail 6 $MAXTEST 'logging to prelude'
-		fi
-	    fi
-
-	    #
-	    # -------------  seventh test -----------
-	    #
-	    if ! test -d /var/run/prelude-manager
-	    then
-		    [ -z "$verbose" ] || log_msg_ok    "create /var/run/prelude-manager...";
-		    sudo mkdir /var/run/prelude-manager
-		    sudo chown prelude:rainer /var/run/prelude-manager
-		    sudo chmod 770 /var/run/prelude-manager
-	    fi
-	    #
-	    PM=`find_path prelude-manager`
-	    if [ -z "$PM" ]; then
-		log_skip 7 $MAXTEST 'prelude-manager not found in $PATH'
-	    elif [ -z "$doall" ]; then
-		log_skip 7 $MAXTEST 'logging to prelude (or use --really-all)'
-	    else
-		BUILDOPTS="--quiet $TRUST --with-prelude --enable-login-watch --enable-mounts-check --enable-process-check --enable-port-check --enable-suidcheck --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
-		testrun1b_nogpg "${BUILDOPTS} CFLAGS=-DSH_NOFAILOVER=1" "modrc"
-		do_test_1b_2
-		if [ $? -eq 0 ]; then
-		    log_ok   7 $MAXTEST 'logging to prelude'
-		else
-		    log_fail 7 $MAXTEST 'logging to prelude'
-		fi
-	    fi
-
-	fi
-    fi
-    log_end "RUN STANDALONE W/STEALTH W/GPG"
-    return 0
-}
-
Index: trunk/test/testrun_1c.sh
===================================================================
--- trunk/test/testrun_1c.sh	(revision 591)
+++ 	(revision )
@@ -1,414 +1,0 @@
-#! /bin/sh
-
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-BUILDOPTS="--quiet $TRUST --enable-xml-log --enable-suidcheck --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"
-export BUILDOPTS
-
-MAXTEST=7; export MAXTEST
-
-## Quarantine SUID/SGID files if found
-#
-# SuidCheckQuarantineFiles = yes
-
-## Method for Quarantining files:
-#  0 - Delete or truncate the file.
-#  1 - Remove SUID/SGID permissions from file.
-#  2 - Move SUID/SGID file to quarantine dir.
-#
-# SuidCheckQuarantineMethod = 0
-
-## For method 0 and 2, really delete instead of truncating
-# 
-# SuidCheckQuarantineDelete = yes
-
-SUIDPOLICY_7="
-[ReadOnly]
-file=${BASE}
-[SuidCheck]
-SuidCheckActive = yes
-SuidCheckExclude = ${BASE}/a/a
-SuidCheckInterval = 10
-SeveritySuidCheck = crit
-SuidCheckQuarantineFiles = no
-SuidCheckQuarantineMethod = 2
-SuidCheckQuarantineDelete = yes
-"
-
-mod_suiddata_7 () {
-    one_sec_sleep
-    chmod 4444 "${BASE}/a/a/y"
-    chmod 4444 "${BASE}/a/a/a/y"
-    mkdir "${BASE}/a/abc"
-    touch "${BASE}/a/abc/y"
-    chmod 4444 "${BASE}/a/abc/y"
-}
-
-chk_suiddata_7 () {
-    one_sec_sleep
-    tmp=`ls -l "${BASE}/a/a/y" 2>/dev/null | awk '{ print $1}' | cut -c 1-10`
-    if [ "x$tmp" = "x-r-Sr--r--" ]; then
-	egrep "CRIT.*POLICY \[SuidCheck\].*${BASE}/a/a/y" $LOGFILE >/dev/null 2>&1
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/y";
-	    return 1
-	fi
-	egrep "CRIT.*POLICY ADDED.*${BASE}/a/a/y" $LOGFILE >/dev/null 2>&1
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/y";
-	    return 1
-	fi
-    else
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/y (suid not kept)";
-	return 1
-    fi
-    tmp=`ls -l "${BASE}/a/a/a/y" 2>/dev/null | awk '{ print $1}' | cut -c 1-10`
-    if [ "x$tmp" = "x-r-Sr--r--" ]; then
-	egrep "CRIT.*POLICY \[SuidCheck\].*${BASE}/a/a/a/y" $LOGFILE >/dev/null 2>&1
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/a/y";
-	    return 1
-	fi
-	egrep "CRIT.*POLICY ADDED.*${BASE}/a/a/a/y" $LOGFILE >/dev/null 2>&1
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/a/y";
-	    return 1
-	fi
-    else
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/a/y (suid not kept)";
-	return 1
-    fi
-    tmp=`ls -l "${BASE}/a/abc/y" 2>/dev/null | awk '{ print $1}' | cut -c 1-10`
-    if [ "x$tmp" = "x-r-Sr--r--" ]; then
-	egrep "CRIT.*POLICY \[SuidCheck\].*${BASE}/a/abc/y" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/a/abc/y";
-	    return 1
-	fi
-	egrep "CRIT.*POLICY ADDED.*${BASE}/a/abc/y" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/a/abc/y";
-	    return 1
-	fi
-	return 0;
-    else
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/abc/y (suid not kept)";
-	return 1
-    fi
-}
-
-
-SUIDPOLICY_6="
-[ReadOnly]
-file=${BASE}
-[SuidCheck]
-SuidCheckActive = yes
-SuidCheckInterval = 10
-SeveritySuidCheck = crit
-SuidCheckQuarantineFiles = no
-SuidCheckQuarantineMethod = 2
-SuidCheckQuarantineDelete = yes
-"
-
-mod_suiddata_6 () {
-    one_sec_sleep
-    chmod 4755 "${BASE}/a/a/y"
-}
-
-chk_suiddata_6 () {
-    one_sec_sleep
-    tmp=`ls -l "${BASE}/a/a/y" 2>/dev/null | awk '{ print $1}' | cut -c 1-10`
-    if [ "x$tmp" = "x-rwsr-xr-x" ]; then
-	egrep "CRIT.*POLICY \[SuidCheck\].*${BASE}/a/a/y" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/y";
-	    return 1
-	fi
-	egrep "CRIT.*POLICY ADDED.*${BASE}/a/a/y" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/y";
-	    return 1
-	fi
-	return 0;
-    else
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/y (suid not kept)";
-	return 1
-    fi
-}
-
-SUIDPOLICY_5="
-[ReadOnly]
-file=${BASE}
-[SuidCheck]
-SuidCheckActive = yes
-SuidCheckInterval = 10
-SeveritySuidCheck = crit
-SuidCheckQuarantineFiles = yes
-SuidCheckQuarantineMethod = 2
-SuidCheckQuarantineDelete = yes
-"
-
-mod_suiddata_5 () {
-    one_sec_sleep
-    chmod 4755 "${BASE}/a/a/y"
-}
-
-chk_suiddata_5 () {
-    one_sec_sleep
-    if [ ! -f "${BASE}/a/a/x" ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/x (erroneously deleted)";
-	return 1
-    fi
-    if [ -f "${BASE}/a/a/y" ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/y (not deleted)";
-	return 1
-    fi
-    if [ -f .quarantine/y ]; then
-	if [ -f .quarantine/y.info ]; then
-	    return 0;
-	else
-	    [ -z "$verbose" ] || log_msg_fail ".quarantine/y.info (missing)";
-	    return 1
-	fi
-    else
-	[ -z "$verbose" ] || log_msg_fail ".quarantine/y (missing)";
-	return 1
-    fi
-}
-
-SUIDPOLICY_4="
-[ReadOnly]
-file=${BASE}
-[SuidCheck]
-SuidCheckActive = yes
-SuidCheckInterval = 10
-SeveritySuidCheck = crit
-SuidCheckQuarantineFiles = yes
-SuidCheckQuarantineMethod = 2
-SuidCheckQuarantineDelete = no
-"
-
-mod_suiddata_4 () {
-    one_sec_sleep
-    chmod 4755 "${BASE}/a/a/y"
-}
-
-chk_suiddata_4 () {
-    one_sec_sleep
-    tmp=`cat "${BASE}/a/a/y" 2>/dev/null | wc -c`
-    if [ $tmp -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/y (not truncated)";
-	return 1
-    fi
-    if [ -f .quarantine/y ]; then
-	if [ -f .quarantine/y.info ]; then
-	    return 0;
-	else
-	    [ -z "$verbose" ] || log_msg_fail ".quarantine/y.info (missing)";
-	    return 1
-	fi
-    else
-	[ -z "$verbose" ] || log_msg_fail ".quarantine/y (missing)";
-	return 1
-    fi
-}
-
-SUIDPOLICY_3="
-[ReadOnly]
-file=${BASE}
-[SuidCheck]
-SuidCheckActive = yes
-SuidCheckInterval = 10
-SeveritySuidCheck = crit
-SuidCheckQuarantineFiles = yes
-SuidCheckQuarantineMethod = 1
-SuidCheckQuarantineDelete = no
-"
-
-mod_suiddata_3 () {
-    one_sec_sleep
-    chmod 4755 "${BASE}/a/a/y"
-}
-
-chk_suiddata_3 () {
-    one_sec_sleep
-    tmp=`ls -l "${BASE}/a/a/y" 2>/dev/null | awk '{ print $1}' | cut -c 1-10`
-    if [ "x$tmp" = "x-rwxr-xr-x" ]; then
-	return 0;
-    else
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/y (suid not removed)";
-	return 1
-    fi
-}
-
-SUIDPOLICY_2="
-[ReadOnly]
-file=${BASE}
-[SuidCheck]
-SuidCheckActive = yes
-SuidCheckInterval = 10
-SeveritySuidCheck = crit
-SuidCheckQuarantineFiles = yes
-SuidCheckQuarantineMethod = 0
-SuidCheckQuarantineDelete = no
-"
-
-mod_suiddata_2 () {
-    one_sec_sleep
-    chmod 4755 "${BASE}/a/a/y"
-}
-
-chk_suiddata_2 () {
-    one_sec_sleep
-    tmp=`cat "${BASE}/a/a/y" 2>/dev/null | wc -c`
-    if [ $tmp -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/y (not truncated)";
-	return 1
-    fi
-}
-
-SUIDPOLICY_1="
-[ReadOnly]
-file=${BASE}
-[SuidCheck]
-SuidCheckActive = yes
-SuidCheckInterval = 10
-SeveritySuidCheck = crit
-SuidCheckQuarantineFiles = yes
-SuidCheckQuarantineMethod = 0
-SuidCheckQuarantineDelete = yes
-"
-
-mod_suiddata_1 () {
-    one_sec_sleep
-    chmod 4755 "${BASE}/a/a/y"
-}
-
-chk_suiddata_1 () {
-    one_sec_sleep
-    if [ -f "${BASE}/a/a/y" ]; then
-	[ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/y (not removed)";
-	return 1
-    fi
-}
-
-prep_suidpolicy ()
-{
-    test -f "${RCFILE}" || touch "${RCFILE}"
-    eval echo '"$'"SUIDPOLICY_$1"'"' >>"${RCFILE}"
-    if [ "x$1" = "x5" ]; then
-	chmod 4755 "${BASE}/a/a/x"
-    fi
-}
-
-testrun_internal_1c ()
-{
-	[ -z "$verbose" ] || echo Working directory: $PW_DIR
-	[ -z "$verbose" ] || { echo MAKE is $MAKE; echo; }
-
-	#
-	# test standalone compilation
-	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
-
-	if test -r "Makefile"; then
-		$MAKE distclean >/dev/null 
-	fi
-
-	${TOP_SRCDIR}/configure ${BUILDOPTS} 
-
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  'DBGDEF=-DSH_SUIDTESTDIR=\"${BASE}\"' >/dev/null 2>&1
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make DBGDEF=-DSH_SUIDTESTDIR=${BASE} ..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	[ -z "$verbose" ] || { echo; echo "${S}Running test suite${E}"; echo; }
-
-	tcount=1
-	POLICY=`eval echo '"$'"SUIDPOLICY_$tcount"'"'`
-
-	until [ -z "$POLICY" ]
-	do
-	  prep_init
-	  check_err $? ${tcount}; errval=$?
-	  if [ $errval -eq 0 ]; then
-	      prep_testdata
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      prep_suidpolicy   ${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      run_init
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      eval mod_suiddata_${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      run_check
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      eval chk_suiddata_${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $testrun1_setup -eq 0 ]; then
-	      if [ $errval -eq 0 ]; then
-		  run_update
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	      if [ $errval -eq 0 ]; then
-		  run_check_after_update
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	  fi
-	  #
-	  if [ $errval -eq 0 ]; then
-	      [ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST};
-	  fi
-	  let "tcount = tcount + 1" >/dev/null
-	  POLICY=`eval echo '"$'"SUIDPOLICY_$tcount"'"'`
-	done
-	    
-	return 0
-}
-
-testrun1c ()
-{
-    log_start "RUN STANDALONE W/SUIDCHK"
-    testrun_internal_1c
-    log_end "RUN STANDALONE W/SUIDCHK"
-    return 0
-}
-
Index: trunk/test/testrun_1d.sh
===================================================================
--- trunk/test/testrun_1d.sh	(revision 591)
+++ 	(revision )
@@ -1,261 +1,0 @@
-#! /bin/sh
-
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-BUILDOPTS="--quiet $TRUST --enable-xml-log --enable-process-check --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"
-export BUILDOPTS
-
-MAXTEST=3; export MAXTEST
-
-PROCPOLICY_3="
-[ReadOnly]
-file=${BASE}
-[ProcessCheck]
-ProcessCheckActive = yes
-ProcessCheckPsPath = ${PW_DIR}/${SCRIPTDIR}/testrun_1d.sh
-ProcessCheckPsArg = --fake
-ProcessCheckMaxPid = 67000
-"
-
-chk_procdata_3 () {
-    one_sec_sleep
-
-    egrep 'CRIT.*POLICY \[Process\] Fake pid: 66666[[:space:]]' $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Fake pid";
-	return 1
-    fi
-    egrep 'CRIT.*POLICY \[Process\] Fake pid: [012345789]+[[:space:]]' $LOGFILE >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Fake pids incorrect";
-	return 1
-    fi
-}
-
-PROCPOLICY_2="
-[ReadOnly]
-file=${BASE}
-[ProcessCheck]
-ProcessCheckActive = yes
-"
-
-chk_procdata_2 () {
-    one_sec_sleep
-
-    egrep 'CRIT.*POLICY \[Process\] Hidden pid' $LOGFILE >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Hidden pids (ps)";
-	return 1
-    fi
-}
-
-
-PROCPOLICY_1="
-[ReadOnly]
-file=${BASE}
-[ProcessCheck]
-ProcessCheckActive = yes
-ProcessCheckPsPath = ${PW_DIR}/${SCRIPTDIR}/testrun_1d.sh
-ProcessCheckPsArg = --hide
-"
-
-
-chk_procdata_1 () {
-    one_sec_sleep
-
-    egrep 'CRIT.*POLICY \[Process\] Hidden pid: [[:digit:]][[:space:]]' $LOGFILE >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Hidden pids";
-	return 1
-    fi
-    egrep 'CRIT.*POLICY \[Process\] Hidden pid: [[:digit:]][[:digit:]]+[[:space:]]' $LOGFILE >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Hidden pids incorrect";
-	return 1
-    fi
-}
-
-prep_procpolicy ()
-{
-    test -f "${RCFILE}" || touch "${RCFILE}"
-    eval echo '"$'"PROCPOLICY_$1"'"' >>"${RCFILE}"
-}
-
-testrun_internal_1d ()
-{
-	[ -z "$verbose" ] || echo Working directory: $PW_DIR
-	[ -z "$verbose" ] || { echo MAKE is $MAKE; echo; }
-
-	#
-	# test standalone compilation
-	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
-
-	if test -r "Makefile"; then
-		$MAKE distclean >/dev/null 
-	fi
-
-	tcount=1
-	${TOP_SRCDIR}/configure ${BUILDOPTS} 
-
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE >/dev/null 2>&1
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	[ -z "$verbose" ] || { echo; echo "${S}Running test suite${E}"; echo; }
-
-	POLICY=`eval echo '"$'"PROCPOLICY_$tcount"'"'`
-
-	until [ -z "$POLICY" ]
-	do
-	  prep_init
-	  check_err $? ${tcount}; errval=$?
-	  if [ $errval -eq 0 ]; then
-	      prep_testdata
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      prep_procpolicy   ${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      run_init
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  for iseq in 0 1 2 3 4 5 6 7 8 9; do
-	      rm -f "$LOGFILE"
-	      if [ $errval -eq 0 ]; then
-		  run_check info
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	      if [ $errval -eq 0 ]; then
-		  eval chk_procdata_${tcount}
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	  done
-	  #
-	  if [ $errval -eq 0 ]; then
-	      [ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST};
-	  fi
-	  let "tcount = tcount + 1" >/dev/null
-	  POLICY=`eval echo '"$'"PROCPOLICY_$tcount"'"'`
-
-	done
-	    
-	return 0
-}
-
-testrun1d ()
-{
-    log_start "RUN STANDALONE W/PROCESSCHECK"
-    testrun_internal_1d
-    log_end "RUN STANDALONE W/PROCESSCHECK"
-    return 0
-}
-
-proc_pspath ()
-{
-    PS=ps
-    for ff in /usr/ucb /bin /usr/bin; do
-	if test -x "$ff/ps"; then
-	    PS="$ff/ps"
-	    break
-	fi
-    done
-    echo "$PS"
-}
-
-proc_psarg ()
-{
-    OS=`uname -s`
-    case $OS in
-	*Linux*|*linux*)
-	    PSARG="-eT";;
-        *OpenBSD*)
-            PSARG="akx";;
-	*)
-	    PS=`proc_pspath`
-	    $PS ax >/dev/null 2>&1
-	    if test $? -eq 0; then
-		one=`$PS ax | wc -l`
-	    else
-		one=0
-	    fi
-	    $PS -e >/dev/null 2>&1
-	    if test $? -eq 0; then
-		two=`$PS -e | wc -l`
-	    else
-		two=0
-	    fi
-	    if test $one -ge $two 
-		then
-		PSARG="ax"
-	    else
-		PSARG="-e"
-	    fi
-	    ;;
-    esac
-    echo "$PSARG"
-}
-
-proc_hide()
-{
-    PSPATH=`proc_pspath`
-    PSARG=`proc_psarg`
-
-    "${PSPATH}" "${PSARG}" | egrep -v '^[[:space:]]*[[:digit:]]{1}[[:space:]]+'
-}
-
-proc_fake()
-{
-    FAKE_PID=2
-    PSPATH=`proc_pspath`
-    PSARG=`proc_psarg`
-
-    "${PSPATH}" "${PSARG}"
-    if [ x"${PSARG}" = x-eT ]; then
-	echo "66666 66666 pts/2    S      0:14 THIS_IS_FAKE"
-    else
-	echo "66666 pts/2    S      0:14 THIS_IS_FAKE"
-    fi
-}
-
-if [ "x$1" = "x--hide" ]; then
-    proc_hide;
-    exit 0;
-fi
-
-if [ "x$1" = "x--fake" ]; then
-    proc_fake;
-    exit 0;
-fi
-
Index: trunk/test/testrun_1e.sh
===================================================================
--- trunk/test/testrun_1e.sh	(revision 591)
+++ 	(revision )
@@ -1,380 +1,0 @@
-#! /bin/sh
-
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-BUILDOPTS="--quiet $TRUST --enable-debug=gdb --enable-xml-log --enable-port-check --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"
-export BUILDOPTS
-
-MAXTEST=5; export MAXTEST
-
-test_log_prelude="/var/log/prelude/prelude-text.log"; export test_log_prelude
-
-PORTPOLICY_5="
-[ReadOnly]
-file=${BASE}
-[PortCheck]
-PortCheckActive = yes
-PortCheckUDP = no
-PortCheckInterface = 127.0.0.1
-"
-
-chk_portdata_5 () {
-    one_sec_sleep
-
-    if [ -z "$PM" ]; then
-	log_skip 5 $MAXTEST 'prelude-manager not found in $PATH'
-    elif [ -z "$doall" ]; then
-	log_skip 5 $MAXTEST 'logging to prelude (or use --really-all)'
-    else
-	tmp=`egrep 'Service: port=5500 .unknown. protocol=tcp' ${test_log_prelude} 2>/dev/null | wc -l`
-	if [ $tmp -lt 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "port 5500";
-	    [ -z "$quiet" ] && log_fail 5 ${MAXTEST};
-	    return 1
-	fi
-    #
-	[ -z "$quiet" ] && log_ok 5 ${MAXTEST};
-    fi
-    return 0
-}
-
-refine_portpolicy_5 ()
-{
-    echo "PortCheckIgnore=2026/tcp" >>"${RCFILE}"
-    echo "PortCheckIgnore=2027/udp" >>"${RCFILE}"
-    echo "PortCheckIgnore=2028/tcp" >>"${RCFILE}"
-    echo "PortCheckIgnore=2029/udp" >>"${RCFILE}"    
-}
-
-PORTPOLICY_4="
-[ReadOnly]
-file=${BASE}
-[PortCheck]
-PortCheckActive = yes
-PortCheckUDP = no
-"
-
-chk_portdata_4 () {
-    one_sec_sleep
-
-    egrep 'CRIT.*POLICY \[ServiceNew\]' $LOGFILE >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || egrep 'CRIT.*POLICY \[ServiceNew\]' $LOGFILE
-	[ -z "$verbose" ] || log_msg_fail "Open ports";
-	return 1
-    fi
-}
-
-refine_portpolicy_4 ()
-{
-    cat "$LOGFILE" | grep ServiceNew | sed 's/.*port: //' | awk '{ print $1 }' | \
-    while read line; do
-	echo "PortCheckSkip=$line" >>"${RCFILE}"
-    done
-    echo "PortCheckIgnore=2026/tcp" >>"${RCFILE}"
-    echo "PortCheckIgnore=2027/udp" >>"${RCFILE}"
-    echo "PortCheckIgnore=2028/tcp" >>"${RCFILE}"
-    echo "PortCheckIgnore=2029/udp" >>"${RCFILE}"
-}
-
-PORTPOLICY_3="
-[ReadOnly]
-file=${BASE}
-[PortCheck]
-PortCheckActive = yes
-PortCheckUDP = no
-"
-
-chk_portdata_3 () {
-    one_sec_sleep
-
-    egrep 'CRIT.*POLICY \[ServiceNew\]' $LOGFILE >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	
-	[ -z "$verbose" ] || log_msg_fail "Open ports";
-	return 1
-    fi
-}
-
-refine_portpolicy_3 ()
-{
-    cat "$LOGFILE" | grep ServiceNew | sed 's/.*port: //' | awk '{ print $1 }' | \
-    while read line; do
-	echo "PortCheckIgnore=$line" >>"${RCFILE}"
-    done
-    echo "PortCheckIgnore=2026/tcp" >>"${RCFILE}"
-    echo "PortCheckIgnore=2027/udp" >>"${RCFILE}"
-    echo "PortCheckIgnore=2028/tcp" >>"${RCFILE}"
-    echo "PortCheckIgnore=2029/udp" >>"${RCFILE}"
-}
-
-
-PORTPOLICY_2="
-[ReadOnly]
-file=${BASE}
-[PortCheck]
-PortCheckActive = yes
-PortCheckUDP = no
-"
-
-chk_portdata_2 () {
-    one_sec_sleep
-
-    egrep 'CRIT.*POLICY \[ServiceNew\]' $LOGFILE >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	
-	[ -z "$verbose" ] || log_msg_fail "Open ports";
-	return 1
-    fi
-}
-
-refine_portpolicy_2 ()
-{
-    cat "$LOGFILE" | grep ServiceNew | sed 's/.*port: //' | awk '{ print $1 }' | \
-    while read line; do
-	echo "PortCheckOptional=$line" >>"${RCFILE}"
-    done
-}
-
-PORTPOLICY_1="
-[ReadOnly]
-file=${BASE}
-[PortCheck]
-PortCheckActive = yes
-PortCheckUDP = no
-"
-
-chk_portdata_1 () {
-    one_sec_sleep
-
-    egrep 'CRIT.*POLICY \[ServiceNew\]' $LOGFILE >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	
-	[ -z "$verbose" ] || log_msg_fail "Open ports";
-	return 1
-    fi
-}
-
-refine_portpolicy_1 ()
-{
-    cat "$LOGFILE" | grep ServiceNew | sed 's/.*port: //' | awk '{ print $1 }' | \
-    while read line; do
-	echo "PortCheckRequired=$line" >>"${RCFILE}"
-    done
-}
-
-prep_portpolicy ()
-{
-    test -f "${RCFILE}" || touch "${RCFILE}"
-    eval echo '"$'"PORTPOLICY_$1"'"' >>"${RCFILE}"
-}
-
-run_check_prelude()
-{
-    echo -n >"${test_log_prelude}"
-
-    ./samhain -t check -p none -l info --set-prelude-severity=info --prelude --server-addr 127.0.0.1:5500 >/dev/null
- 
-    if test x$? = x0; then
-
-	./samhain -j -L $LOGFILE >"${LOGFILE}.tmp" && mv "${LOGFILE}.tmp" "${LOGFILE}"
-
-	if [ $? -ne 0 ]; then
-	    [ -z "$quiet" ]   && log_msg_fail  "mv logfile...";
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "check...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "check...";
-	return 1
-    fi
-}
-
-
-testrun_internal_1e ()
-{
-	[ -z "$verbose" ] || echo Working directory: $PW_DIR
-	[ -z "$verbose" ] || { echo MAKE is $MAKE; echo; }
-
-	#
-	# test standalone compilation
-	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
-
-	if test -r "Makefile"; then
-		$MAKE distclean >/dev/null 
-	fi
-
-	tcount=1
-	${TOP_SRCDIR}/configure ${BUILDOPTS} 
-
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE >/dev/null 2>&1
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	[ -z "$verbose" ] || { echo; echo "${S}Running test suite${E}"; echo; }
-
-	POLICY=`eval echo '"$'"PORTPOLICY_$tcount"'"'`
-
-	until [ -z "$POLICY" ]
-	do
-	  prep_init
-	  check_err $? ${tcount}; errval=$?
-	  if [ $errval -eq 0 ]; then
-	      prep_testdata
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      prep_portpolicy   ${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      run_init
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  #
-	  if [ $errval -eq 0 ]; then
-	      eval refine_portpolicy_${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  #
-	  rm -f "$LOGFILE"
-	  #
-	  PRELUDEPID=0
-	  #
-	  if test ${tcount} -eq 5; 
-	  then
-
-	      PM=`find_path prelude-manager`
-
-	      if [ -z "$PM" ]; then
-		  if [ $errval -eq 0 ]; then
-		      run_check
-		      check_err $? ${tcount}; errval=$?
-		  fi
-	      elif [ -z "$doall" ]; then
-		  if [ $errval -eq 0 ]; then
-		      run_check
-		      check_err $? ${tcount}; errval=$?
-		  fi
-	      else
-		  #
-		  #
-		  ${TOP_SRCDIR}/configure ${BUILDOPTS} --with-prelude
-		  #
-	          #
-		  if test x$? = x0; then
-		      [ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		      $MAKE >/dev/null 2>&1
-		      if test x$? = x0; then
-			  [ -z "$verbose" ] || log_msg_ok "make..."; 
-		      else
-			  [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-			  return 1
-		      fi
-
-		  else
-		      [ -z "$quiet" ] &&       log_msg_fail "configure...";
-		      return 1
-		  fi
-		  #
-		  #
-		  if ! test -d /var/run/prelude-manager
-		  then
-		      [ -z "$verbose" ] || log_msg_ok    "create /var/run/prelude-manager...";
-		      sudo mkdir /var/run/prelude-manager
-		      sudo chown prelude:rainer /var/run/prelude-manager
-		      sudo chmod 770 /var/run/prelude-manager
-		  fi
-		  if ! test -d /var/spool/prelude/samhain/global
-		  then
-		      [ -z "$verbose" ] || log_msg_ok    "create /var/spool/prelude/samhain/global...";
-		      sudo mkdir -p /var/spool/prelude/samhain/global
-		      sudo chown prelude:rainer /var/spool/prelude/samhain/global
-		      sudo chmod 770 /var/spool/prelude/samhain/global
-		  fi
-
-		  #
-		  #
-		  #[ -z "$verbose" ] || { echo " starting prelude-manager.."; echo " ($PM --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 &)"; }
-		  #"$PM" --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 &
-		  #PRELUDEPID=$!
-		  #
-		  #
-		  five_sec_sleep
-		  #
-		  #
-		  if [ $errval -eq 0 ]; then
-		      run_check_prelude
-		      check_err $? ${tcount}; errval=$?
-		  fi
-	      fi
-
-	  else
-	      if [ $errval -eq 0 ]; then
-		  run_check
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	  fi
-	  #
-	  if [ $errval -eq 0 ]; then
-	      eval chk_portdata_${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  #
-	  if [ $errval -eq 0 ]; then
-	      if test ${tcount} -ne 5; then
-		  [ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST};
-	      fi
-	  fi
-	  let "tcount = tcount + 1" >/dev/null
-	  POLICY=`eval echo '"$'"PORTPOLICY_$tcount"'"'`
-
-	  if test $PRELUDEPID -ne 0;
-	  then
-	      kill $PRELUDEPID
-	  fi
-
-	done
-	    
-	return 0
-}
-
-testrun1e ()
-{
-    log_start "RUN STANDALONE W/PORTCHECK"
-    testrun_internal_1e
-    log_end "RUN STANDALONE W/PORTCHECK"
-    return 0
-}
-
-
Index: trunk/test/testrun_1f.sh
===================================================================
--- trunk/test/testrun_1f.sh	(revision 591)
+++ 	(revision )
@@ -1,292 +1,0 @@
-#! /bin/sh
-
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-
-# --enable-login-watch --enable-xml-log 
-# --enable-debug --enable-suidcheck --with-prelude
-
-BUILDOPTS="--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 --with-gpg=/usr/bin/gpg --with-keyid=0x8A0B337A  --with-fp=DCCBBB6625591ECE2B8F3AC94ED99E4E8A0B337A"
-export BUILDOPTS
-
-BASE="${PW_DIR}/testrun_testdata"; export BASE
-TDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c"; export TDIRS
-TFILES="x y z"; export TFILES
-
-###########################################################
-#
-# ---- [Define tests here] ----
-#
-
-# 1 for testing new tests
-testrun1_setup=0
-
-MAXTEST=17; export MAXTEST
-
-TESTPOLICY_17="
-[ReadOnly]
-dir=${BASE}
-"
-mod_testdata_17 () {
-    one_sec_sleep
-    rm "${BASE}/a/a/c/x"   # delete 
-}
-
-TESTPOLICY_16="
-[ReadOnly]
-dir=${BASE}
-"
-mod_testdata_16 () {
-    one_sec_sleep
-    echo "foobar" > "${BASE}/foo"   # new 
-}
-
-prep_sign_file ()
-{
-    scripts/samhainadmin.pl  -m R $1 >/dev/null
-    scripts/samhainadmin.pl  -k 8A0B337A -m E $1 >/dev/null
-}
-
-
-run_check_CLverify ()
-{
-    if [ "x$1" = "x"  ]; then
-	logsev=debug
-    else
-	logsev=$1
-    fi
-    if test -f ./.samhain_file; then
-	mv ./.samhain_file ./.samhain_file_clverify
-	if [ $? -ne 0 ]; then
-	    [ -z "$quiet" ]   && log_msg_fail  "mv ./.samhain_file ...";
-	    return 1
-	fi
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "test -f ./.samhain_file ...";
-	return 1
-    fi
-
-    rm -f test_log_valgrind
-
-    ${VALGRIND} ./samhain -p =err --verify-database ./.samhain_file_clverify 2>>test_log_valgrind
- 
-    if test x$? = x0; then
-	if [ "x$2" != "xnullok"  ]; then
-	    [ -z "$quiet" ]   && log_msg_fail  "check (1)...";
-	    return 1
-	fi
-    else
-	if [ "x$2" = "xnullok"  ]; then
-	    [ -z "$quiet" ]   && log_msg_fail  "check (1)...";
-	    return 1
-	fi
-    fi
-
-    LL=`wc -l test_log_valgrind | awk '{ print $1; }'`
-    if ! test x$LL = x0; then
-	[ -z "$quiet" ]   && log_msg_fail  "check (2)...";
-	[ -z "$quiet" ]   && cat test_log_valgrind
-	return 1
-    fi
-    
-    [ -z "$verbose" ] || log_msg_ok    "check...";
-}
-
-run_update_CLverify ()
-{
-    if test -f ./.samhain_file_clverify; then
-	mv ./.samhain_file_clverify ./.samhain_file
-	if [ $? -ne 0 ]; then
-	    [ -z "$quiet" ]   && log_msg_fail  "mv ./.samhain_file_clverify ...";
-	    return 1
-	fi
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "test -f ./.samhain_file_clverify ...";
-	return 1
-    fi
-
-    ${VALGRIND} ./samhain -t update -p none -l debug 2>>test_log_valgrind
-
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "update...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "update...";
-	return 1
-    fi
-}
-
-run_check_after_update_CLverify ()
-{
-    rm -rf $LOGFILE
-
-    run_check_CLverify debug nullok
-}
-
-testrun_internal_CLverify ()
-{
-	[ -z "$verbose" ] || echo Working directory: $PW_DIR
-	[ -z "$verbose" ] || { echo MAKE is $MAKE; echo; }
-
-	#
-	# test standalone compilation
-	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
-
-	if test -r "Makefile"; then
-		$MAKE distclean >/dev/null 
-	fi
-
-	${TOP_SRCDIR}/configure ${BUILDOPTS} 
-
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  >/dev/null 2>>test_log
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	[ -z "$verbose" ] || { echo; echo "${S}Running test suite${E}"; echo; }
-
-	tcount=1
-	POLICY=`eval echo '"$'"TESTPOLICY_$tcount"'"'`
-
-	until [ -z "$POLICY" ]
-	do
-	  prep_init
-	  check_err $? ${tcount}; errval=$?
-	  if [ $errval -eq 0 ]; then
-	      prep_testdata
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      prep_testpolicy   ${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      prep_sign_file  "${RCFILE}"
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      run_init
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      prep_sign_file  ./.samhain_file
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      eval mod_testdata_${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      run_check_CLverify
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $testrun1_setup -eq 0 ]; then
-	      if [ $errval -eq 0 ]; then
-		  prep_sign_file  "${RCFILE}"
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	      if [ $errval -eq 0 ]; then
-		  run_update_CLverify
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	      if [ $errval -eq 0 ]; then
-		  prep_sign_file  ./.samhain_file
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	      if [ $errval -eq 0 ]; then
-		  run_check_after_update_CLverify
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	  fi
-	  #
-	  if [ $errval -eq 0 ]; then
-	      [ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST};
-	  fi
-	  #
-	  let "tcount = tcount + 1" >/dev/null
-	  #
-	  if [ $tcount -eq 10 ]; then
-	      if [ -z "$doall" ]; then
-		  log_skip 10 $MAXTEST 'ACL/SELinux test (or use --really-all)'
-		  log_skip 11 $MAXTEST 'ACL/SELinux test (or use --really-all)'
-		  let "tcount = tcount + 2" >/dev/null
-	      else
-		  # 'id -u' is posix
-		  #
-		  if test -f /usr/xpg4/bin/id
-		  then
-		      my_uid=`/usr/xpg4/bin/id -u`
-		  else
-		      my_uid=`id -u`
-		  fi
-		  #
-		  if [ ${my_uid} -ne 0 ]; then
-		      log_skip 10 $MAXTEST 'ACL/SELinux test (you are not root)'
-		      log_skip 11 $MAXTEST 'ACL/SELinux test (you are not root)'
-		      let "tcount = tcount + 2" >/dev/null
-		  else
-
-		      SETFATTR=`find_path setfattr`
-		      if [ -z "$SETFATTR" ]; then
-			  log_skip 10 $MAXTEST 'ACL/SELinux test (setfattr not in path)'
-			  log_skip 11 $MAXTEST 'ACL/SELinux test (setfattr not in path)'
-			  let "tcount = tcount + 2" >/dev/null
-		      fi
-		  fi
-	      fi
-	  fi
-	  #
-	  POLICY=`eval echo '"$'"TESTPOLICY_$tcount"'"'`
-	done
-	    
-	return 0
-}
-
-testrun1f ()
-{
-    log_start "RUN CL Verify"
-    gpg --list-keys | grep 8A0B337A >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	echo "You need to do 'gpg --import test/gnupg/public-key.asc' first"
-	for ff in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17; do
-	    log_skip $ff $MAXTEST 'CL verify'
-	done
-    else
-	testrun_internal_CLverify
-    fi
-    log_end "RUN CL Verify"
-    return 0
-}
-
-
-
Index: trunk/test/testrun_1g.sh
===================================================================
--- trunk/test/testrun_1g.sh	(revision 591)
+++ 	(revision )
@@ -1,114 +1,0 @@
-#! /bin/sh
-
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-BUILDOPTS="--quiet $TRUST --enable-debug --enable-xml-log --enable-login-watch --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"
-export BUILDOPTS
-
-MAXTEST=1; export MAXTEST
-
-testrun_deltadb ()
-{
-    tcount=1
-
-    if test -r "Makefile"; then
-	$MAKE distclean >/dev/null 
-    fi
-    
-    ${TOP_SRCDIR}/configure ${BUILDOPTS} 
-    
-    if test x$? = x0; then
-	[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-	$MAKE  >/dev/null 2>>test_log
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok "make..."; 
-	else
-	    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-	    return 1
-	fi
-	
-    else
-	[ -z "$quiet" ] &&       log_msg_fail "configure...";
-	return 1
-    fi
-
-    prep_init
-    check_err $? ${tcount}; errval=$?
-
-    if [ $errval -eq 0 ]; then
-	prep_testdata
-	check_err $? ${tcount}; errval=$?
-    fi
-    if [ $errval -eq 0 ]; then
-	prep_testpolicy   1
-	check_err $? ${tcount}; errval=$?
-    fi
-
-    rm "${BASE}/a/a/b/x"
-    rm -f file.*.*-*-*-*-*
-
-    ./samhain --create-database=./tmp_list_file
-
-    check_err $? ${tcount}; errval=$?
-    if [ $errval -eq 0 ]; then
-	num=$( ./samhain -a -d file.*.*-*-*-*-* | grep "1970-01-01T00:00:00" >/dev/null | wc -l )
-	if [ $num -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_ok "list...";
-	else
-	    [ -z "$quiet" ] &&       log_msg_fail "list...";
-	    log_fail ${tcount} ${MAXTEST};
-	fi
-    else
-	[ -z "$quiet" ] &&       log_msg_fail "create...";
-	log_fail ${tcount} ${MAXTEST};
-    fi
-
-    if [ $errval -eq 0 ]; then
-	./samhain --verify-database file.*.*-*-*-*-*
-    fi
-
-    check_err $? ${tcount}; errval=$?
-    if [ $errval -eq 0 ]; then
-	echo "o_O" > "${BASE}/a/a/b/y"
-	./samhain --verify-database file.*.*-*-*-*-*
-    fi
-    if [ $? -eq 0 ]; then
-	[ -z "$quiet" ] &&       log_msg_fail "detect modify...";
-	check_err 1 ${tcount}; errval=1
-    fi
-
-    if [ $errval -eq 0 ]; then
-	[ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST};
-    fi
-
-    [ -z "$cleanup" ] || rm -f file.*.*-*-*-*-*
-    return 0
-}
-
-testrun1g ()
-{
-    log_start "RUN CL Create DeltaDB"
-
-    testrun_deltadb
-
-    log_end "RUN CL Create DeltaDB"
-    return 0
-}
-
Index: trunk/test/testrun_1h.sh
===================================================================
--- trunk/test/testrun_1h.sh	(revision 591)
+++ 	(revision )
@@ -1,305 +1,0 @@
-#! /bin/sh
-
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-
-# --enable-login-watch --enable-xml-log 
-# --enable-debug --enable-suidcheck --with-prelude
-
-BUILDOPTS="--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"
-export BUILDOPTS
-
-BASE="${PW_DIR}/testrun_testdata"; export BASE
-TDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c"; export TDIRS
-TFILES="x y z"; export TFILES
-TFILES_PART="c/miss c/add c/change c/leave"; export TFILES_PART
-
-###########################################################
-#
-# ---- [Define tests here] ----
-#
-
-# 1 for testing new tests
-testrun1_setup=0
-
-MAXTEST=5; export MAXTEST
-
-PARTIAL_OUTFILE=".samhain_file_partial"; export PARTIAL_OUTFILE
-PARTIAL_FILTER="c/create c/miss c/change c/leave"; export PARTIAL_FILTER
-
-TEST_PART_POLICY_1="
-[ReadOnly]
-dir=${BASE}
-"
-mod_testdata_partial_1 () {
-    one_sec_sleep
-    rm "${BASE}/a/a/c/x"   # delete 
-}
-EXPECT_1="nullok"
-
-TEST_PART_POLICY_2="
-[ReadOnly]
-dir=${BASE}
-"
-mod_testdata_partial_2 () {
-    one_sec_sleep
-    echo "foobar" > "${BASE}/foo"   # new 
-}
-EXPECT_2="nullok"
-
-TEST_PART_POLICY_3="
-[ReadOnly]
-dir=${BASE}
-"
-mod_testdata_partial_3 () {
-    one_sec_sleep
-    rm -f "${BASE}/c/miss"
-}
-EXPECT_3=""
-
-TEST_PART_POLICY_4="
-[ReadOnly]
-dir=${BASE}
-"
-mod_testdata_partial_4 () {
-    one_sec_sleep
-    echo foo >"${BASE}/c/create"
-}
-EXPECT_4=""
-
-TEST_PART_POLICY_5="
-[ReadOnly]
-dir=${BASE}
-"
-mod_testdata_partial_5 () {
-    one_sec_sleep
-    echo toodledoo >"${BASE}/c/change"
-}
-EXPECT_5=""
-
-#
-# $2 == "nullok" means no mods should be detected,
-# else it is an error to detect no mods
-#
-run_check_partial_verify ()
-{
-    if [ "x$1" = "x"  ]; then
-	logsev=debug
-    else
-	logsev=$1
-    fi
-    if ! test -f ${PARTIAL_OUTFILE}; then
-	[ -z "$quiet" ]   && log_msg_fail  "missing ${PARTIAL_OUTFILE} ...";
-	return 1
-    fi
-
-    rm -f test_log_valgrind
-
-    ${VALGRIND} ./samhain -p =err --verify-database ${PARTIAL_OUTFILE} 2>>test_log_valgrind
- 
-    if test x$? = x0; then
-	if [ "x$2" != "xnullok"  ]; then
-	    [ -z "$quiet" ]   && log_msg_fail  "check (1a)...";
-	    return 1
-	fi
-    else
-	if [ "x$2" = "xnullok"  ]; then
-	    [ -z "$quiet" ]   && log_msg_fail  "check (1b)...";
-	    return 1
-	fi
-    fi
-
-    LL=`wc -l test_log_valgrind | awk '{ print $1; }'`
-    if ! test x$LL = x0; then
-	[ -z "$quiet" ]   && log_msg_fail  "check (2)...";
-	[ -z "$quiet" ]   && cat test_log_valgrind
-	return 1
-    fi
-    
-    [ -z "$verbose" ] || log_msg_ok    "check...";
-}
-
-run_update_partial_verify ()
-{
-    ${VALGRIND} ./samhain -t update -p none -l debug 2>>test_log_valgrind
-
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "update...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "update...";
-	return 1
-    fi
-}
-
-run_check_after_update_partial ()
-{
-    rm -rf $LOGFILE
-
-    run_check_partial_verify debug nullok
-}
-
-create_partial ()
-{
-    echo "${BASE}/c" > test_filter.txt
-    for ff in ${TFILES_PART}; do
-	echo "${BASE}/${ff}" >> test_filter.txt
-    done
-
-    ./samhain -o "${PARTIAL_OUTFILE}" --binary --list-filter=test_filter.txt --list-database=./.samhain_file
-
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "create partial DB...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "create partial DB...";
-	return 1
-    fi
-
-    if test -f "${PARTIAL_OUTFILE}"; then
-	[ -z "$verbose" ] || log_msg_ok    "partial DB exists...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "partial DB exists...";
-	return 1
-    fi
-    rm -f test_filter.txt
-}
-
-prep_partial_testpolicy ()
-{
-    test -f "${RCFILE}" || touch "${RCFILE}"
-    eval echo '"$'"TEST_PART_POLICY_$1"'"' >>"${RCFILE}"
-}
-
-prep_testdata_partial ()
-{
-    prep_testdata
-    if test x$? = x0; then
-	touch "${BASE}/c/miss"
-	touch "${BASE}/c/change"
-	touch "${BASE}/c/leave"
-    else
-	return 1
-    fi
-}
-
-testrun_internal_partial_verify ()
-{
-	[ -z "$verbose" ] || echo Working directory: $PW_DIR
-	[ -z "$verbose" ] || { echo MAKE is $MAKE; echo; }
-
-	#
-	# test standalone compilation
-	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
-
-	if test -r "Makefile"; then
-		$MAKE distclean >/dev/null 
-	fi
-
-	${TOP_SRCDIR}/configure ${BUILDOPTS} 
-
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  >/dev/null 2>>test_log
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	[ -z "$verbose" ] || { echo; echo "${S}Running test suite${E}"; echo; }
-
-	tcount=1
-	POLICY=`eval echo '"$'"TEST_PART_POLICY_$tcount"'"'`
-
-	until [ -z "$POLICY" ]
-	do
-	  prep_init
-	  check_err $? ${tcount}; errval=$?
-	  if [ $errval -eq 0 ]; then
-	      prep_testdata_partial
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      prep_partial_testpolicy   ${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      run_init
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      create_partial
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      eval mod_testdata_partial_${tcount}
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $errval -eq 0 ]; then
-	      arg2=`eval echo '"$'"EXPECT_$tcount"'"'`
-	      run_check_partial_verify debug $arg2
-	      check_err $? ${tcount}; errval=$?
-	  fi
-	  if [ $testrun1_setup -eq 0 ]; then
-	      if [ $errval -eq 0 ]; then
-		  run_update_partial_verify
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	      if [ $errval -eq 0 ]; then
-		  create_partial
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	      if [ $errval -eq 0 ]; then
-		  run_check_after_update_partial
-		  check_err $? ${tcount}; errval=$?
-	      fi
-	  fi
-	  #
-	  if [ $errval -eq 0 ]; then
-	      [ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST};
-	  fi
-	  #
-	  let "tcount = tcount + 1" >/dev/null
-	  #
-	  POLICY=`eval echo '"$'"TEST_PART_POLICY_$tcount"'"'`
-	done
-	    
-	return 0
-}
-
-testrun1h ()
-{
-    log_start "RUN CL Partial DB Verify"
-    testrun_internal_partial_verify
-    log_end "RUN CL Partial DB Verify"
-    return 0
-}
-
-
-
Index: trunk/test/testrun_1i.sh
===================================================================
--- trunk/test/testrun_1i.sh	(revision 591)
+++ 	(revision )
@@ -1,322 +1,0 @@
-#! /bin/sh
-
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-MAXTEST=4; export MAXTEST
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
-
-testrun1b_modrc ()
-{
-        ORIGINAL="\[EOF\]"
-        REPLACEMENT="\[PortCheck\]"
-        ex -s $RCFILE <<EOF
-%s/$ORIGINAL/$REPLACEMENT/g
-wq
-EOF
-
-        echo "PortCheckActive = yes" >>"$RCFILE"
-        echo "PortCheckInterface = 127.0.0.1" >>"$RCFILE"
-}
-
-testrun1b_internal ()
-{
-	BUILDOPTS="$1"
-	#
-	# test standalone compilation
-	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
-	#
-	if test -r "Makefile"; then
-		$MAKE distclean >/dev/null >&1
-	fi
-	#
-	# Bootstrapping
-	#
-	${TOP_SRCDIR}/configure >/dev/null 2>/dev/null
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure (bootstrap)..."; 
-		$MAKE  > /dev/null 2>&1
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make (bootstrap)..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make (bootstrap)..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure (bootstrap)...";
-		return 1
-	fi
-	#
-	#
-	${TOP_SRCDIR}/configure ${BUILDOPTS} 2>/dev/null
-	#
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  > /dev/null 2>&1
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	cp ${SCRIPTDIR}/testrc_1i.dyn "$RCFILE"
-	
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "copy signed config file...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "copy signed config file...";
-	    return 1
-	fi
-
-	if test "x$2" = "x"; then
-	    :
-	else
-	    CONVERT="$2"
-	    if test -f "${TOP_SRCDIR}/stealth_template.jpg"; then
-		[ -z "$verbose" ] || log_msg_ok "convert..."
-		"${CONVERT}" +compress "${TOP_SRCDIR}/stealth_template.jpg" stealth_template.ps >/dev/null
-	    else
-		[ -z "$quiet" ]   && log_msg_fail  "cannot find file stealth_template.jpg"
-		return 1
-	    fi
-	    if [ $? -ne 0 ]; then
-		[ -z "$quiet" ]   && log_msg_fail  "${CONVERT} +compress ${TOP_SRCDIR}/stealth_template.jpg stealth_template.ps";
-		return 1
-	    fi
-
-	    [ -z "$verbose" ] || log_msg_ok "hide..."
-	    ./samhain_stealth -s stealth_template.ps "$RCFILE" >/dev/null
-	    if [ $? -ne 0 ]; then
-		[ -z "$quiet" ]   && log_msg_fail  "${CONVERT} +compress ${TOP_SRCDIR}/stealth_template.jpg stealth_template.ps";
-		return 1
-	    fi
-
-	    mv -f stealth_template.ps "$RCFILE"
-	    if [ $? -ne 0 ]; then
-		[ -z "$quiet" ]   && log_msg_fail  "mv -f stealth_template.ps $RCFILE";
-		return 1
-	    fi
-
-	fi
-
-	rm -f ./.samhain_file
-	rm -f ./.samhain_log
-	rm -f ./.samhain_lock
-
-	./samhain -t init -p none -l info
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "init...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "init...";
-	    return 1
-	fi
-
-	cp ${SCRIPTDIR}/test1i_file.sig $PW_DIR/.samhain_file
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "copy signed database file...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "copy signed database file...";
-	    return 1
-	fi
-}
-
-testrun1b_nogpg ()
-{
-	BUILDOPTS="$1"
-	#
-	# test standalone compilation
-	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
-	#
-	if test -r "Makefile"; then
-		$MAKE distclean >/dev/null >&1
-	fi
-
-	${TOP_SRCDIR}/configure ${BUILDOPTS} 2>/dev/null 
-        #
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  > /dev/null 2>&1
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	rm -f ./.samhain_file
-	rm -f ./.samhain_log
-	rm -f ./.samhain_lock
-
-	cp "${SCRIPTDIR}/testrc_1" "${RCFILE}"
-
-	if test "x$2" = "xmodrc"; then
-	    [ -z "$verbose" ] || log_msg_ok    "mod rc...";
-	    testrun1b_modrc
-	fi
-
-	./samhain -t init -p none -l info
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "init...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "init...";
-	    return 1
-	fi
-
-}
-
-do_test_1b () {
-
-    ./samhain -t check -p none -l info
-    
-    if test x$? = x0; then
-	./samhain -j -L $LOGFILE >"${LOGFILE}.tmp" && mv "${LOGFILE}.tmp" "${LOGFILE}"
-	if [ $? -ne 0 ]; then
-	    [ -z "$quiet" ]   && log_msg_fail  "mv logfile...";
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "check...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "check...";
-	return 1
-    fi
-    #
-    tmp=`egrep "Checking.*/etc(>|\")" $LOGFILE 2>/dev/null | wc -l`
-    if [ $tmp -ne 2 ]; then
-	[ -z "$verbose" ] || log_msg_fail "/etc";
-	return 1
-    fi
-    tmp=`egrep "Checking.*(>|\")" $LOGFILE 2>/dev/null | wc -l`
-    if [ $tmp -ne 10 ]; then
-	[ -z "$verbose" ] || log_msg_fail "checking";
-	return 1
-    fi
-    egrep "ADDED" $LOGFILE >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "init was incomplete";
-	return 1
-    fi
-    #
-    return 0
-}
-
-testrun1i ()
-{
-    log_start "RUN STANDALONE W/STEALTH W/SIGNIFY"
-    SIGNIFY=`find_path signify-openbsd`
-    if [ -z "$SIGNIFY" ]; then
-	SIGNIFY=`find_path signify`
-    fi
-    if [ -z "$SIGNIFY" ]; then
-	log_skip 1 $MAXTEST 'signify not found in $PATH'
-	log_skip 2 $MAXTEST 'signify not found in $PATH'
-	log_skip 3 $MAXTEST 'signify not found in $PATH'
-	log_skip 4 $MAXTEST 'signify not found in $PATH'
-    else
-	eval "ls ~/.signify/samhain.pub >/dev/null 2>/dev/null"
-	if [ $? -ne 0 ]; then
-	    log_skip 1 $MAXTEST 'public key ~/.signify/samhain.pub not present'
-	    log_skip 2 $MAXTEST 'public key ~/.signify/samhain.pub not present'
-	    log_skip 3 $MAXTEST 'public key ~/.signify/samhain.pub not present'
-	    log_skip 4 $MAXTEST 'public key ~/.signify/samhain.pub not present'
-	else
-	    #
-	    # -------------  first test -------------
-	    #
-	    BUILDOPTS="--quiet $TRUST --enable-debug --with-signify=${SIGNIFY} --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
-	    testrun1b_internal "${BUILDOPTS}" 
-	    do_test_1b
-	    if [ $? -eq 0 ]; then
-		log_ok   1 $MAXTEST 'signify signed config/database files'
-	    else
-		log_fail 1 $MAXTEST 'signify signed config/database files'
-	    fi
-
-
-	    #
-	    # -------------  second test -------------
-	    #
-	    BUILDOPTS="--quiet $TRUST --enable-debug --with-signify=${SIGNIFY} --with-checksum --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
-	    testrun1b_internal "${BUILDOPTS}" 
-	    do_test_1b
-	    if [ $? -eq 0 ]; then
-		log_ok   2 $MAXTEST 'signify signed config/database files'
-	    else
-		log_fail 2 $MAXTEST 'signify signed config/database files'
-	    fi
-
-
-	    #
-	    # -------------  third test -------------
-	    #
-	    BUILDOPTS="--quiet $TRUST --enable-debug --with-signify=${SIGNIFY} --with-checksum --with-pubkey-checksum=62F3EAE3CD9BA8849015060750908790B6326015A20AC0DA --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
-	    testrun1b_internal "${BUILDOPTS}" 
-	    do_test_1b
-	    if [ $? -eq 0 ]; then
-		log_ok   3 $MAXTEST 'signify signed config/database files'
-	    else
-		log_fail 3 $MAXTEST 'signify signed config/database files'
-	    fi
-
-
-	    #
-	    # -------------  fourth test -------------
-	    #
-	    PRECONV=`find_path convert`
-	    "${PRECONV}" --help | grep  ImageMagick >/dev/null 2>&1 && \
- 		CONVERT="${PRECONV}"
-
-	    if [ -z "$CONVERT" ]; then
-		log_skip 2 $MAXTEST 'ImageMagick convert not found in $PATH'
-	    else
-		BUILDOPTS="--quiet $TRUST --enable-debug --with-signify=${SIGNIFY} --with-checksum --enable-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
-		testrun1b_internal "${BUILDOPTS}" "$CONVERT"
-		do_test_1b
-		if [ $? -eq 0 ]; then
-		    log_ok   4 $MAXTEST 'signify signed config/database files'
-		else
-		    log_fail 4 $MAXTEST 'signify signed config/database files'
-		fi
-	    fi
-
-	fi
-    fi
-    log_end "RUN STANDALONE W/STEALTH W/SIGNIFY"
-    return 0
-}
-
Index: trunk/test/testrun_2.sh
===================================================================
--- trunk/test/testrun_2.sh	(revision 591)
+++ trunk/test/testrun_2.sh	(revision 1)
@@ -1,631 +1,66 @@
 #! /bin/sh
 
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
 
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-RCFILE="$PW_DIR/testrc_2";  export RCFILE
-HTML="$PW_DIR/yule.html";  export HTML
+# The following two are the ANSI sequences for start and end embolden
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
 
+PW_DIR=`pwd`
 
-do_test_1 () {
+if test x$UID != x; then
+  TRUST="--with-trusted=0,2,$UID"
+else
+  TRUST="--with-trusted=0,2"
+fi
 
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Server${E}: ./yule -l info -p none &"; 
-	    echo; 
-	}
+echo; echo "${S}__ STARTING TEST RUN CLIENT/SERVER __${E}"; echo;
+echo Working directory: $PW_DIR
 
-	rm -f test_log_valgrind
+MAKE=`which gmake`
+if test "x$?" = x1 ; then
+    MAKE="make -s"
+else
+    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$MAKE" = x; then
+	MAKE="make -s"
+    elif test "x$MAKE" = xno; then
+	MAKE="make -s"
+    else
+	if test "x$MAKE" = "xwhich:"; then
+		MAKE="make -s"
+	else
+		MAKE="gmake -s"
+		gmake -v >/dev/null 2>&1 || MAKE="make -s"
+	fi
+    fi
+fi
 
-	${VALGRIND} ./yule.2 -l info -p none >/dev/null 2>>test_log_valgrind &
-	PROC_Y2=$!
-	five_sec_sleep
+echo MAKE is $MAKE
+echo
 
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Server #2${E}: ./yule.2 -l info -p none &"; 
-	    echo; 
-	}
+# --with-database=postgresql
+# export MYLIB=-L/usr/local/pgsql/lib
+# export MYINC=-I/usr/local/pgsql/include
+# export LD_LIBRARY_PATH=/usr/local/pgsql/lib
 
-	${VALGRIND} ./yule -l info -p none -e info --bind-address=127.0.0.1 \
-	    --server-port=49778 >/dev/null 2>>test_log_valgrind &
-	PROC_Y=$!
-	five_sec_sleep
+# --with-database=mysql
+# export MYLIB=-L/usr/local/mysql/lib
+# export MYINC=-I/usr/local/mysql/include
+# export LD_LIBRARY_PATH=/usr/local/mysql/lib
 
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check"; 
-	    echo; 
-	}
-
-	${VALGRIND} ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 >/dev/null 2>>test_log_valgrind
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "samhain.new -t check";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "samhain.new -t check";
-	    kill $PROC_Y
-	    kill $PROC_Y2
-	    return 1
-	fi
-
-	kill $PROC_Y
-	kill $PROC_Y2
-	five_sec_sleep
-
-	# cp ${LOGFILE}  triple_test
-	# cp ${LOGFILE}2 triple_test_2
-
-	egrep "START(>|\").*Yule(>|\")" ${LOGFILE}2 >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server #2 start";
-	    return 1
-	fi
-	egrep "remote_host.*Checking.*/bin" ${LOGFILE}2 >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (relayed)";
-	    return 1
-	fi
-	egrep "remote_host.*EXIT.*Samhain" ${LOGFILE}2 >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client exit (relayed)";
-	    return 1
-	fi
-	egrep "EXIT.*Yule.*SIGTERM" ${LOGFILE}2 >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server #2 exit";
-	    return 1
-	fi
-
-
-	egrep "START(>|\").*Yule(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server start";
-	    return 1
-	fi
-	egrep "NEW CLIENT" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client connect";
-	    return 1
-	fi
-	egrep "remote_host.*Checking.*/bin" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check";
-	    return 1
-	fi
-	egrep "remote_host.*EXIT.*Samhain" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client exit";
-	    return 1
-	fi
-	egrep "EXIT.*Yule.*SIGTERM" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server exit";
-	    return 1
-	fi
-
-	[ -z "$VALGRIND" ] || {
-	    tmp=`cat test_log_valgrind 2>/dev/null | wc -l`;
-	    if [ $tmp -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "valgrind reports errors";
-		cat test_log_valgrind
-		return 1;
-	    fi;
-	}
-
-	return 0
-}
-
-do_test_2 () {
-
-        ORIGINAL="UseSeparateLogs=no"
-	REPLACEMENT="UseSeparateLogs=yes"
-        ex -s $RCFILE <<EOF
-%s/$ORIGINAL/$REPLACEMENT/g
-wq
-EOF
-# :%s is the "ex" substitution command.
-# :wq is write-and-quit.
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Server${E}: ./yule -l info -p none &"; 
-	    echo; 
-	}
-
-	rm -f $LOGFILE
-	rm -f test_log_valgrind
-
-	${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind &
-	PROC_Y=$!
-	five_sec_sleep
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check"; 
-	    echo; 
-	}
-
-	${VALGRIND} ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 >/dev/null 2>>test_log_valgrind
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "samhain.new -t check";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "samhain.new -t check";
-	    kill $PROC_Y
-	    return 1
-	fi
-
-	kill $PROC_Y
-	five_sec_sleep
-
-	if [ -f ${LOGFILE}.${SH_LOCALHOST} ]; then
-	    remhost=${SH_LOCALHOST}
-	else
-	    remhost=`echo $SH_LOCALHOST | sed 's,\..*,,'`
-	fi
-	if [ -f ${LOGFILE}.${remhost} ]; then
-	    CLIENTLOG="${LOGFILE}.${remhost}"
-	else
-	    tail -n 1 ${SCRIPTDIR}/test.sh >/dev/null 2>&1
-	    if [ $? -eq 0 ]; then
-		CLIENTLOG=`ls -1 ${LOGFILE}.* 2>/dev/null | tail -n 1`
-	    else
-		CLIENTLOG=`ls -1 ${LOGFILE}.* 2>/dev/null | tail -1`
-	    fi
-	fi
-
-	egrep "START(>|\").*Yule(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server start";
-	    return 1
-	fi
-	egrep "NEW CLIENT" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client connect";
-	    return 1
-	fi
-	egrep "remote_host.*Checking.*/bin" ${CLIENTLOG} >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check";
-	    return 1
-	fi
-	egrep "remote_host.*EXIT.*Samhain" ${CLIENTLOG} >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client exit";
-	    return 1
-	fi
-	egrep "EXIT.*Yule.*SIGTERM" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server exit";
-	    return 1
-	fi
-
-	[ -z "$VALGRIND" ] || {
-	    tmp=`cat test_log_valgrind 2>/dev/null | wc -l`;
-	    if [ $tmp -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "valgrind reports errors";
-		cat test_log_valgrind
-		return 1;
-	    fi;
-	}
-	
-	rm -f ${LOGFILE}.${remhost}
-	return 0
-}
-
-do_test_3 () {
-
-        ORIGINAL_1="ExportSeverity=none"
-        REPLACEMENT_1="ExportSeverity=mark"
-	ORIGINAL_2="UseSeparateLogs=yes"
-	REPLACEMENT_2="UseSeparateLogs=no"
-	ORIGINAL_3="LogSeverity=none"
-	REPLACEMENT_3="LogSeverity=debug"
-	ORIGINAL_4="# SetClientTimeLimit=1800"
-	REPLACEMENT_4="SetClientTimeLimit=20"
-	# takes too much time if we leave that in
-	ORIGINAL_5="dir=1"
-	REPLACEMENT_5="#dir=1"
-        ex -s $RCFILE <<EOF
-%s/${ORIGINAL_1}/${REPLACEMENT_1}/g
-%s/${ORIGINAL_2}/${REPLACEMENT_2}/g
-%s/${ORIGINAL_3}/${REPLACEMENT_3}/g
-%s/${ORIGINAL_4}/${REPLACEMENT_4}/g
-%s/${ORIGINAL_5}/${REPLACEMENT_5}/g
-wq
-EOF
-# :%s is the "ex" substitution command.
-# :wq is write-and-quit.
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Server${E}: ./yule -p none -e none &"; 
-	    echo; 
-	}
-
-	rm -f $LOGFILE
-	rm -f test_log_valgrind
-
-	${VALGRIND} ./yule -p none -e none >/dev/null 2>>test_log_valgrind &
-	PROC_Y=$!
-	five_sec_sleep
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Client${E}: ./samhain.new -t check -p none -l none --forever --bind-address=127.0.0.1 &"; 
-	    echo; 
-	}
-
-	${VALGRIND} ./samhain.new -t check -p none -l none --forever --bind-address=127.0.0.1 >/dev/null 2>>test_log_valgrind &
-	if test x$? = x0; then
-	    PROC_S=$!
-	    # echo "PID is ${PROC_S}"
-	    [ -z "$verbose" ] || log_msg_ok    "samhain.new -t check";
-	    five_sec_sleep
-	    # Redirect the shells (un-)helpful job monitoring messages.
-	    # The 'disown' buildin is not portable. 
-	    { kill -9 ${PROC_S}; sleep 40; } >/dev/null 2>&1
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "samhain.new -t check";
-	    kill $PROC_Y
-	    return 1
-	fi
-
-	if [ -t 0 ]; then
-	    # enable monitor mode again if interactive
-	    set -m
-	fi
-
-	kill $PROC_Y
-	five_sec_sleep
-
-	egrep "START(>|\").*Yule(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server start";
-	    return 1
-	fi
-	egrep "NEW CLIENT" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client connect";
-	    return 1
-	fi
-	egrep "remote_host.*File check completed.*" ${LOGFILE} >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check";
-	    return 1
-	fi
-	egrep "Time limit exceeded" ${LOGFILE} >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client dead detection";
-	    return 1
-	fi
-	egrep "EXIT.*Yule.*SIGTERM" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server exit";
-	    return 1
-	fi
-
-	[ -z "$VALGRIND" ] || {
-	    tmp=`cat test_log_valgrind 2>/dev/null | wc -l`;
-	    if [ $tmp -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "valgrind reports errors";
-		cat test_log_valgrind
-		return 1;
-	    fi;
-	}
-	
-	rm -f ${LOGFILE}
-	return 0
-}
-
-do_test_4 () {
-
-        # don't know what is supported on the test platform, so
-        # prepare for both (password and socket credential)
-
-        # 'id -u' is posix
-        if test -f /usr/xpg4/bin/id
-	then
-	    me=`/usr/xpg4/bin/id -u`
-	else
-	    me=`id -u`
-	fi
-
-	ORIGINAL_1="SetSocketAllowUid=0"
-	REPLACEMENT_1="SetSocketAllowUid=$me"
-        ex -s $RCFILE <<EOF
-%s/${ORIGINAL_1}/${REPLACEMENT_1}/g
-wq
-EOF
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Server${E}: ./yule -l info -p none &"; 
-	    echo; 
-	}
-
-	rm -f $LOGFILE
-	rm -f test_log_valgrind
-
-	${VALGRIND} ./yule -l info -p none -e none \
-	    >/dev/null 2>>test_log_valgrind &
-	PROC_Y=$!
-	five_sec_sleep
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check"; 
-	    echo; 
-	}
-
-	$MAKE yulectl >/dev/null 
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "make yulectl";
-	    kill $PROC_Y
-	    return 1
-	fi
-
-
-	./yulectl -v -c RELOAD foobar1 >test_log_yulectl 2>/dev/null
-
-	if [ $? -ne 0 ]; then 
-	    YULECTL_PASSWORD=samhain; export YULECTL_PASSWORD
-	    ./yulectl -v -c RELOAD foobar1 >test_log_yulectl
-	    if [ $? -ne 0 ]; then
-		kill ${PROC_Y}
-		[ -z "$verbose" ] || log_msg_fail "yulectl";
-		return 1
-	    fi
-	fi
-
-	./yulectl -v -c RELOAD foobar2 >test_yulectl_log
-
-	if [ $? -ne 0 ]; then
-	    kill ${PROC_Y}
-	    [ -z "$verbose" ] || log_msg_fail "yulectl";
-	    return 1
-	fi
-
-	./yulectl -v -c RELOAD foobar3 >test_log_yulectl
-
-	if [ $? -ne 0 ]; then
-	    kill ${PROC_Y}
-	    [ -z "$verbose" ] || log_msg_fail "yulectl";
-	    return 1
-	fi
-
-	./yulectl -v -c LISTALL dummy >test_log_yulectl
-
-	if [ $? -ne 0 ]; then
-	    kill ${PROC_Y}
-	    [ -z "$verbose" ] || log_msg_fail "yulectl";
-	    return 1
-	fi
-
-	tmp=`cat test_log_yulectl | grep RELOAD | wc -l`
-	if [ $tmp -ne 3 ]; then
-	    kill ${PROC_Y}
-	    [ -z "$verbose" ] || log_msg_fail "command confirmation";
-	    return 1
-	fi
-
-	./yulectl -v -c CANCEL foobar3 >test_log_yulectl
-
-	if [ $? -ne 0 ]; then
-	    kill ${PROC_Y}
-	    [ -z "$verbose" ] || log_msg_fail "yulectl";
-	    return 1
-	fi
-
-	./yulectl -v -c LISTALL dummy >test_log_yulectl
-
-	if [ $? -ne 0 ]; then
-	    kill ${PROC_Y}
-	    [ -z "$verbose" ] || log_msg_fail "yulectl";
-	    return 1
-	fi
-
-	tmp=`cat test_log_yulectl | grep RELOAD | wc -l`
-	if [ $tmp -ne 2 ]; then
-	    kill ${PROC_Y}
-	    [ -z "$verbose" ] || log_msg_fail "command confirmation";
-	    return 1
-	fi
-
-	kill ${PROC_Y}
-	one_sec_sleep
-	one_sec_sleep
-	kill -9 ${PROC_Y} >/dev/null 2>&1
-
-	[ -z "$VALGRIND" ] || {
-	    tmp=`cat test_log_valgrind 2>/dev/null | wc -l`;
-	    if [ $tmp -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "valgrind reports errors";
-		cat test_log_valgrind
-		return 1;
-	    fi;
-	}
-	
-	return 0
-}
-
-do_test_5 () {
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Server${E}: ./yule -l info -p none &"; 
-	    echo; 
-	}
-
-( cat <<EOF
-<!-- head -->
-<html><head><title>test</title></head>
-<body>
-Current time: %T <br>
-<table>
-<!-- ehead -->
-EOF
-) >head.html
-
-( cat <<EOF
-<!-- foot -->
-</table>
-</body>
-<!-- efoot -->
-EOF
-) >foot.html
-
-( cat <<EOF
-<!-- entry -->
-<tr>
-  <td>%H</td>
-  <td>%S</td>
-  <td>%T</td>
-</tr>
-<!-- eentry -->
-EOF
-) >entry.html
-
-	${VALGRIND} ./yule -l info -p none -e none \
-	    >/dev/null 2>>test_log_valgrind &
-	PROC_Y=$!
-	five_sec_sleep
-
-	egrep '<!-- head -->' $HTML >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    # rm -f head.html; rm -f foot.html; rm -f entry.html;
-	    kill $PROC_Y
-	    [ -z "$verbose" ] || log_msg_fail "head.html (1)";
-	    return 1
-	fi
-
-	egrep '<!-- foot -->' $HTML >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    rm -f head.html; rm -f foot.html; rm -f entry.html;
-	    kill $PROC_Y
-	    [ -z "$verbose" ] || log_msg_fail "foot.html (1)";
-	    return 1
-	fi
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check"; 
-	    echo; 
-	}
-
-	${VALGRIND} ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 >/dev/null 2>>test_log_valgrind
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "samhain.new -t check";
-	else
-	    kill $PROC_Y
-	    [ -z "$quiet" ]   && log_msg_fail  "samhain.new -t check";
-	    return 1
-	fi
-
-	cp $HTML  ${HTML}.tmp
-
-	kill $PROC_Y
-	five_sec_sleep
-
-	# rm -f head.html; rm -f foot.html; rm -f entry.html;
-
-	egrep "START(>|\").*Yule(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server start";
-	    return 1
-	fi
-	egrep "NEW CLIENT" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client connect";
-	    return 1
-	fi
-	egrep "remote_host.*Checking.*/bin" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check";
-	    return 1
-	fi
-	egrep "remote_host.*EXIT.*Samhain" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client exit";
-	    return 1
-	fi
-	egrep "EXIT.*Yule.*SIGTERM" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server exit";
-	    return 1
-	fi
-
-	egrep '<!-- head -->' ${HTML}.tmp >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "head.html";
-	    return 1
-	fi
-	egrep '<!-- ehead -->' ${HTML}.tmp >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "end head.html";
-	    return 1
-	fi
-
-	egrep '<!-- entry -->' ${HTML}.tmp >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "entry.html";
-	    return 1
-	fi
-	egrep '<!-- eentry -->' ${HTML}.tmp >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "end entry.html";
-	    return 1
-	fi
-
-	egrep '<!-- foot -->' ${HTML}.tmp >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "foot.html";
-	    return 1
-	fi
-	egrep '<!-- efoot -->' ${HTML}.tmp >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "end foot.html";
-	    return 1
-	fi
-
-	[ -z "$VALGRIND" ] || {
-	    tmp=`cat test_log_valgrind 2>/dev/null | wc -l`;
-	    if [ $tmp -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "valgrind reports errors";
-		cat test_log_valgrind
-		return 1;
-	    fi;
-	}
-
-	rm ${HTML}.tmp
-
-	return 0
-}
-
-
-testrun2_internal ()
+testrun2 ()
 {
-        [ -z "$verbose" ] || { 
-	    echo; 
-	    echo Working directory: $PW_DIR; echo MAKE is $MAKE; 
-	    echo; 
-	}
 	#
+	# test standalone compilation
 	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building client and server${E}"; echo; }
+	echo "${S}Building client and server${E}"; echo;
 	#
 	if test -r "Makefile"; then
@@ -633,69 +68,48 @@
 	fi
 	#
-	${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=client  --enable-xml-log --enable-login-watch --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-encrypt=2 --enable-static
+	${TOP_SRCDIR}/configure --quiet  $TRUST --enable-network=client  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/testrc_2  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file --enable-encrypt=2
 	#
 	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  > /dev/null 2>>test_log
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
 		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
+		    echo "$MAKE completed, exit status $?"; echo;
 		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
 		fi
 
 	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	# save binary and build server2
-	#
-	cp samhain samhain.build || return 1
-	$MAKE clean >/dev/null || return 1
-
-	${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=server  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=${RCFILE}2  --with-log-file=${LOGFILE}2 --with-pid-file=$PW_DIR/.samhain_lock2 --with-html-file=${HTML}2 --with-state-dir=$PW_DIR --enable-encrypt=2 --with-port=49778
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  > /dev/null 2>>test_log
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
 	fi
 
 	# save binary and build server
 	#
-	cp yule yule.2 || return 1
-	$MAKE clean >/dev/null || return 1
+	cp samhain samhain.build
+	make clean
 
-	${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=server  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-html-file=$HTML --with-state-dir=$PW_DIR --enable-encrypt=2
+	${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=server  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/testrc_2  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file --enable-identity=rainer --enable-encrypt=2
 	#
 	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  > /dev/null 2>>test_log
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
 		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
+		    echo "$MAKE completed, exit status $?"; echo;
 		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
 		fi
 
 	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
 	fi
-
 
 	#####################################################################
 	#
 	#
+	echo "${S}Initialize database${E}"; echo;
+
 	rm -f ./.samhain_file
 	rm -f ./.samhain_log
@@ -704,12 +118,8 @@
 	cp ${SCRIPTDIR}/testrc_2.in testrc_2
 
-	./samhain.build -t init -p none
+	echo "./samhain.build -t init"
+	./samhain.build -t init
 
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "init...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "init...";
-	    return 1
-	fi
+	SHINI=$?
 
 	# Create a password
@@ -717,112 +127,64 @@
 	SHPW=`./yule -G`
 	if test x"$SHPW" = x; then
-	    [ -z "$quiet" ]   && log_msg_fail  "password not generated -- aborting"
-	    return 1
+	    echo "password not generated -- aborting"
+	    exit 1
 	fi
 
 	# Set in client
 
-	./samhain_setpwd samhain.build new $SHPW >/dev/null
+	echo "./samhain_setpwd samhain.build new $SHPW"
+	./samhain_setpwd samhain.build new $SHPW
 
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "./samhain_setpwd samhain.build new $SHPW";
+	mv samhain.build.new  samhain.new
+
+	rm -f ./.samhain_log.*
+	rm -f ./.samhain_lock
+
+	SHCLT=`./yule -P $SHPW | sed s%HOSTNAME%${SH_LOCALHOST}%`
+
+ 	echo $SHCLT >> testrc_2
+
+	if test x$SHINI = x0; then
+		echo; echo "${S}Start Server${E}: ./yule  &"; echo;
+		./yule -l info &
+		PROC_Y=$!
+		sleep 5
+
+		echo; echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check";
+
+		./samhain.new -t check -p none -l none -e info
+		if test x$? = x0; then
+		    echo "${S}check completed${E}"
+		else
+		    echo "${S}ERROR:${E} -- check -- failed, exit status $?"
+		    echo
+		    kill $PROC_Y
+		    exit
+		fi
+
+		kill $PROC_Y
+		sleep 5
 	else
-	    [ -z "$quiet" ]   && log_msg_fail  "./samhain_setpwd samhain.build new $SHPW";
-	    return 1
+		echo "${S}ERROR:${E} -- init -- failed, exit status $SHINI"; 
+		echo;
+		exit
 	fi
-
-	mv samhain.build.new  samhain.new || return 1
-
-	# Set in server
-
-	./samhain_setpwd yule new $SHPW >/dev/null
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "./samhain_setpwd yule new $SHPW";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "./samhain_setpwd yule new $SHPW";
-	    return 1
-	fi
-
-	mv yule.new yule || return 1
-
-	#
-
-	rm -f ./.samhain_log*
-	rm -f ./.samhain_lock*
-
-	SHCLT=`./yule -P $SHPW`
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "yule -P $SHPW";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "yule -P $SHPW";
-	    return 1
-	fi
-
-	SHCLT1=`echo "${SHCLT}"  | sed s%HOSTNAME%${SH_LOCALHOST}%`
-	AHOST=`find_hostname`
-	SHCLT2=`echo "${SHCLT}"  | sed s%HOSTNAME%${AHOST}%`
-	
-
- 	echo $SHCLT1 >> testrc_2
- 	echo $SHCLT2 >> testrc_2
-	cp testrc_2 testrc_22
-
-	do_test_1
-	if [ $? -eq 0 ]; then
-	    [ -z "$quiet" ] && log_ok   1 ${MAXTEST} "Client logging";
-	else
-	    [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client logging";
-	fi
-
-	do_test_2
-	if [ $? -eq 0 ]; then
-	    [ -z "$quiet" ] && log_ok   2 ${MAXTEST} "Client logging, separate logfiles";
-	else
-	    [ -z "$quiet" ] && log_fail 2 ${MAXTEST} "Client logging, separate logfiles";
-	fi
-
-	do_test_3
-	if [ $? -eq 0 ]; then
-	    [ -z "$quiet" ] && log_ok   3 ${MAXTEST} "Dead client detection";
-	else
-	    [ -z "$quiet" ] && log_fail 3 ${MAXTEST} "Dead client detection";
-	fi
-
-	do_test_4
-	if [ $? -eq 0 ]; then
-	    [ -z "$quiet" ] && log_ok   4 ${MAXTEST} "Server command socket";
-	else
-	    [ -z "$quiet" ] && log_fail 4 ${MAXTEST} "Server command socket";
-	fi
-
-	do_test_5
-	if [ $? -eq 0 ]; then
-	    [ -z "$quiet" ] && log_ok   5 ${MAXTEST} "Server status file";
-	else
-	    [ -z "$quiet" ] && log_fail 5 ${MAXTEST} "Server status file";
-	fi
-
-	return $?
+	    
 }
 
-MAXTEST=5; export MAXTEST
+    if test x$1 = x; then
+	echo
+	echo "Please provide the local hostname as argument."
+	echo
+	exit 8
+    fi
 
-testrun2 ()
-{
-    log_start "RUN CLIENT/SERVER"
+    SH_LOCALHOST=$1; export SH_LOCALHOST
 
-    if [ x"$1" = x ]; then
-	[ -z "$quiet" ] && log_msg_fail "Missing hostname"
-    fi
-    #
-    SH_LOCALHOST=$1; export SH_LOCALHOST
-    #
-    testrun2_internal
-    #
-    log_end "RUN CLIENT/SERVER"
+    testrun2
 
-    return 0
-}
 
+echo; echo "${S}__ END TEST RUN CLIENT/SERVER __${E}"; echo;
+
+exit
+
Index: trunk/test/testrun_2a.sh
===================================================================
--- trunk/test/testrun_2a.sh	(revision 591)
+++ trunk/test/testrun_2a.sh	(revision 1)
@@ -1,109 +1,58 @@
 #! /bin/sh
 
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
 
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-RCFILE="$PW_DIR/testrc_2";  export RCFILE
+# The following two are the ANSI sequences for start and end embolden
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
 
-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 --enable-debug=gdb"; export SERVER_BUILDOPTS
+PW_DIR=`pwd`
 
-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-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --enable-suidcheck --enable-debug"; export CLIENT_BUILDOPTS
+if test x$UID != x; then
+  TRUST="--with-trusted=0,2,$UID"
+else
+  TRUST="--with-trusted=0,2"
+fi
 
-do_test_1_a () {
+echo; echo "${S}__ STARTING TEST RUN CLIENT/SERVER __${E}"; echo;
+echo Working directory: $PW_DIR
 
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Server${E}: ./yule -l info -p none &"; 
-	    echo; 
-	}
-	rm -f test_log_valgrind
+MAKE=`which gmake`
+if test "x$?" = x1 ; then
+    MAKE="make -s"
+else
+    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$MAKE" = x; then
+	MAKE="make -s"
+    elif test "x$MAKE" = xno; then
+	MAKE="make -s"
+    else
+	if test "x$MAKE" = "xwhich:"; then
+		MAKE="make -s"
+	else
+		MAKE="gmake -s"
+		gmake -v >/dev/null 2>&1 || MAKE="make -s"
+	fi
+    fi
+fi
 
-	${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind &
-	PROC_Y=$!
-	five_sec_sleep
+echo MAKE is $MAKE
+echo
 
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check --bind-address=127.0.0.1 --server-host=localhost"; 
-	    echo; 
-	}
 
-	${VALGRIND} ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 --server-host=localhost >/dev/null 2>>test_log_valgrind
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "samhain.new -t check";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "samhain.new -t check";
-	    kill $PROC_Y
-	    return 1
-	fi
 
-	kill $PROC_Y
-	five_sec_sleep
-
-	egrep "START(>|\").*Yule(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server start";
-	    return 1
-	fi
-	egrep "NEW CLIENT" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client connect";
-	    return 1
-	fi
-	egrep "Checking.*/etc" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check";
-	    return 1
-	fi
-	egrep "EXIT.*Samhain" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client exit";
-	    return 1
-	fi
-	egrep "EXIT.*Yule.*SIGTERM" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server exit";
-	    return 1
-	fi
-	
-	[ -z "$VALGRIND" ] || {
-	    tmp=`cat test_log_valgrind 2>/dev/null | wc -l`;
-	    if [ $tmp -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "valgrind reports errors";
-		cat test_log_valgrind
-		return 1;
-	    fi;
-	}
-
-	return 0
-}
-
-testrun2a_internal ()
+testrun2a ()
 {
-        [ -z "$verbose" ] || { 
-	    echo; 
-	    echo Working directory: $PW_DIR; echo MAKE is $MAKE; 
-	    echo; 
-	}
 	#
+	# test standalone compilation
 	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building client and server${E}"; echo; }
+	echo "${S}Building client and server${E}"; echo;
 	#
 	if test -r "Makefile"; then
@@ -111,51 +60,50 @@
 	fi
 	#
-	${TOP_SRCDIR}/configure ${CLIENT_BUILDOPTS}
+	${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=client --enable-srp --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=localhost  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock 
 	#
-	# Limit suid check
-	#
-	BASE="${PW_DIR}"; export BASE
+	# --disable-encrypt
 	#
 	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  'DBGDEF=-DSH_SUIDTESTDIR=\"${BASE}\"' > /dev/null 2>>test_log
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
 		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
+		    echo "$MAKE completed, exit status $?"; echo;
 		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
 		fi
 
 	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
 	fi
 
 	# save binary and build server
 	#
-	cp samhain samhain.build || return 1
-	$MAKE clean >/dev/null || return 1
+	cp samhain samhain.build
+	make clean
 
-	${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS}
+	#
+	${TOP_SRCDIR}/configure --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
+	# --enable-identity=rainer
+	# --with-libwrap
 	#
 	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  > /dev/null 2>>test_log
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
 		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
+		    echo "$MAKE completed, exit status $?"; echo;
 		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
 		fi
 
 	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
 	fi
 
+	echo "${S}Initialize database${E}"; echo;
 
-	#####################################################################
-	#
-	#
 	rm -f ./.samhain_file
 	rm -f ./.samhain_log
@@ -163,17 +111,11 @@
 	rm -f ./rc.${SH_LOCALHOST}
 	rm -f ./file.${SH_LOCALHOST}
-	rm -f  "./rc.${ALTHOST}"
-	rm -f  "./file.${ALTHOST}"
 
 	cp ${SCRIPTDIR}/testrc_2.in testrc_2
 
-	./samhain.build -t init -p none
+	echo "./samhain.build -t init"
+	./samhain.build -t init
 
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "init...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "init...";
-	    return 1
-	fi
+	SHINI=$?
 
 	# Create a password
@@ -181,122 +123,67 @@
 	SHPW=`./yule -G`
 	if test x"$SHPW" = x; then
-	    [ -z "$quiet" ]   && log_msg_fail  "password not generated -- aborting"
-	    return 1
+	    echo "password not generated -- aborting"
+	    exit 1
 	fi
 
 	# Set in client
 
-	./samhain_setpwd samhain.build new $SHPW >/dev/null
+	echo "./samhain_setpwd samhain.build new $SHPW"
+	./samhain_setpwd samhain.build new $SHPW
 
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "./samhain_setpwd samhain.build new $SHPW";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "./samhain_setpwd samhain.build new $SHPW";
-	    return 1
-	fi
+	mv samhain.build.new  samhain.new
 
-	mv samhain.build.new  samhain.new || return 1
-
-	rm -f ./.samhain_log*
+	rm -f ./.samhain_log
 	rm -f ./.samhain_lock
-
-	SHCLT=`./yule -P $SHPW`
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "yule -P $SHPW";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "yule -P $SHPW";
-	    return 1
-	fi
-
-	SHCLT1=`echo "${SHCLT}"  | sed s%HOSTNAME%${SH_LOCALHOST}%`
-	AHOST=`find_hostname`
-	SHCLT2=`echo "${SHCLT}"  | sed s%HOSTNAME%${AHOST}%`
-	
-
- 	echo $SHCLT1 >> testrc_2
- 	echo $SHCLT2 >> testrc_2
-
 
 	cp    ./testrc_2       ./rc.${SH_LOCALHOST}
 	mv    ./.samhain_file  ./file.${SH_LOCALHOST}
-	chmod 644 ./rc.${SH_LOCALHOST}
-	chmod 644 ./file.${SH_LOCALHOST}
 
-	ALTHOST=`find_hostname`
-	cp    ./testrc_2       "./rc.${ALTHOST}"
-	cp    ./file.${SH_LOCALHOST} "./file.${ALTHOST}" 2>/dev/null
-	chmod 644 ./rc.${ALTHOST}
-	chmod 644 ./file.${ALTHOST}
+	SHCLT=`./yule -P $SHPW | sed s%HOSTNAME%${SH_LOCALHOST}%`
 
-	echo $SHPW > ./testpw
+ 	echo $SHCLT >> testrc_2
+
+	if test x$SHINI = x0; then
+		echo; echo "${S}Start Server${E}: ./yule  &"; echo;
+		./yule -q &
+		PROC_Y=$!
+		sleep 5
+
+		echo; echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check";
+
+		./samhain.new -t check -p none -l none -e info 
+		if test x$? = x0; then
+		    echo "${S}check completed${E}"
+		else
+		    echo "${S}ERROR:${E} -- check -- failed, exit status $?"
+		    echo
+		    kill $PROC_Y
+		    exit
+		fi
+
+		kill $PROC_Y
+		sleep 5
+	else
+		echo "${S}ERROR:${E} -- init -- failed, exit status $SHINI"; 
+		echo;
+		exit
+	fi
+	    
 }
 
-MAXTEST=4; export MAXTEST
+    if test x$1 = x; then
+	echo
+	echo "Please provide the local hostname as argument."
+	echo
+	exit 8
+    fi
 
-testrun2a ()
-{
-    log_start "RUN FULL CLIENT/SERVER";
-    #
-    if [ x"$1" = x ]; then
-	[ -z "$quiet" ] && log_msg_fail "Missing hostname"
-    fi
-    #
     SH_LOCALHOST=$1; export SH_LOCALHOST
-    #
-    testrun2a_internal
-    do_test_1_a
-    if [ $? -eq 0 ]; then
-	[ -z "$quiet" ] && log_ok   1 ${MAXTEST} "Client download+logging";
-    else
-	[ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client download+logging";
-    fi
-    ####### EXIT HERE FOR TESTING ######
-    #
-    #
-    SERVER_BUILDOPTS_ORIG="${SERVER_BUILDOPTS}"
-    CLIENT_BUILDOPTS_ORIG="${CLIENT_BUILDOPTS}"
-    #
-    SERVER_BUILDOPTS="${SERVER_BUILDOPTS_ORIG} --disable-srp"; export SERVER_BUILDOPTS
-    CLIENT_BUILDOPTS="${CLIENT_BUILDOPTS_ORIG} --disable-srp"; export CLIENT_BUILDOPTS
-    #
-    testrun2a_internal
-    do_test_1_a
-    if [ $? -eq 0 ]; then
-	[ -z "$quiet" ] && log_ok   2 ${MAXTEST} "SRP disabled";
-    else
-	[ -z "$quiet" ] && log_fail 2 ${MAXTEST} "SRP disabled";
-    fi
-    #
-    SERVER_BUILDOPTS="${SERVER_BUILDOPTS_ORIG} --disable-encrypt"; export SERVER_BUILDOPTS
-    CLIENT_BUILDOPTS="${CLIENT_BUILDOPTS_ORIG} --disable-encrypt"; export CLIENT_BUILDOPTS
-    #
-    testrun2a_internal
-    do_test_1_a
-    if [ $? -eq 0 ]; then
-	[ -z "$quiet" ] && log_ok   3 ${MAXTEST} "Encryption disabled";
-    else
-	[ -z "$quiet" ] && log_fail 3 ${MAXTEST} "Encryption disabled";
-    fi
-    #
-    SERVER_BUILDOPTS="${SERVER_BUILDOPTS_ORIG} --disable-ipv6"; export SERVER_BUILDOPTS
-    CLIENT_BUILDOPTS="${CLIENT_BUILDOPTS_ORIG} --disable-ipv6"; export CLIENT_BUILDOPTS
-    #
-    testrun2a_internal
-    do_test_1_a
-    if [ $? -eq 0 ]; then
-	[ -z "$quiet" ] && log_ok   4 ${MAXTEST} "IPv6 disabled";
-    else
-	[ -z "$quiet" ] && log_fail 4 ${MAXTEST} "IPv6 disabled";
-    fi
-    #
-    if [ -n "$cleanup" ]; then
-	rm -f ./rc.${SH_LOCALHOST}
-	rm -f ./file.${SH_LOCALHOST}
-	ALTHOST=`find_hostname`
-	rm -f "./file.${ALTHOST}"
-	rm -f "./rc.${ALTHOST}"
-    fi
-    #
-    log_end "RUN FULL CLIENT/SERVER"
-}
+
+    testrun2a
+
+
+echo; echo "${S}__ END TEST RUN CLIENT/SERVER __${E}"; echo;
+
+exit
+
Index: trunk/test/testrun_2b.sh
===================================================================
--- trunk/test/testrun_2b.sh	(revision 591)
+++ trunk/test/testrun_2b.sh	(revision 1)
@@ -1,215 +1,221 @@
 #! /bin/sh
 
+
+# The following two are the ANSI sequences for start and end embolden
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
+
+PW_DIR=`pwd`
+
+if test x$UID != x; then
+  TRUST="--with-trusted=0,2,$UID"
+else
+  TRUST="--with-trusted=0,2"
+fi
+
+TEST_MYSQL=
+# TEST_MYSQL=" --with-database=mysql --with-libs=-L/usr/local/mysql/lib "
+export TEST_MYSQL
+
+echo; echo "${S}__ STARTING TEST RUN CLIENT/SERVER W/GPG __${E}"; echo;
+echo Working directory: $PW_DIR
+
+MAKE=`which gmake`
+if test "x$?" = x1 ; then
+    MAKE="make -s"
+else
+    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$MAKE" = x; then
+	MAKE="make -s"
+    elif test "x$MAKE" = xno; then
+	MAKE="make -s"
+    else
+	if test "x$MAKE" = "xwhich:"; then
+		MAKE="make -s"
+	else
+		MAKE="gmake -s"
+		gmake -v >/dev/null 2>&1 || MAKE="make -s"
+	fi
+    fi
+fi
+
+echo MAKE is $MAKE
+echo
+
+# $GPG_PATH _must_ be an absolute path
 #
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-RCFILE="$PW_DIR/testrc_2";  export RCFILE
-RCFILE_C="$PW_DIR/testrc_1.dyn";  export RCFILE_C
-
-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-micro-stealth=137 --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_C} --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
-
-testrun2b_internal ()
-{
-    GPG="$1"
-
-    [ -z "$verbose" ] || { 
-	echo; 
-	echo Working directory: $PW_DIR; echo MAKE is $MAKE; echo GPG is $GPG;
-	echo; 
-    }
-
-    [ -z "$verbose" ] || { echo; echo "${S}Building client and server${E}"; echo; }
-
-    if test -r "Makefile"; then
-	$MAKE distclean
+if test x${GPG_PATH} = x; then
+    GPG_PATH=`which gpg | sed -e "s%\([a-z:]\) .*%\1%g"`
+fi
+
+if test x${GPG_PATH} = x; then
+    echo "ERROR: gpg (GnuPG) not found"
+    exit
+else
+    GPG_OK=`echo ${GPG_PATH} | sed -e "s%\(/.*\)%OK%g"`
+    if test x${GPG_OK} = xOK; then
+        echo "GPG_PATH is ${GPG_PATH}"
+    else
+        echo "ERROR: GPG_PATH (${GPG_PATH}) is _not_ an absolute path."
+        echo
+        echo "  Apparently the command 'which gpg' did not yield an absolute path."
+        echo "  You can fix the problem by setting the environment variable GPG_PATH"
+        echo "  to the absolute path to gpg (GnuPG) and start the test again."
+        exit
     fi
-
-    ${TOP_SRCDIR}/configure --with-gpg=${GPG} --with-checksum=no ${CLIENT_BUILDOPTS} >/dev/null 2>&1
-
-    if test x$? = x0; then
-	[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-	$MAKE  > /dev/null 2>>test_log
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok "make..."; 
-	else
-	    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-	    return 1
-	fi
-    else
-	[ -z "$quiet" ] &&       log_msg_fail "configure...";
-	return 1
-    fi
-    
-    SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' ${SCRIPTDIR}/test.sh`
-    
-    tail -n "+$SKIP" ${SCRIPTDIR}/test.sh >/dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	tail -n "+$SKIP" ${SCRIPTDIR}/test.sh | gunzip -c - 2>/dev/null | tar xf - &&  \
-	    mv "./testrc.gpg.asc" "${RCFILE_C}"
-    else
-	tail "+$SKIP" ${SCRIPTDIR}/test.sh | gunzip -c - 2>/dev/null | tar xf - &&  \
-	    mv "./testrc.gpg.asc" "${RCFILE_C}"
-    fi
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "extract gpg signed files...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "extract gpg signed files...";
-	return 1
-    fi
-
-    # save binary and build server
-
-    cp samhain samhain.build || return 1
-    $MAKE clean >/dev/null || return 1
-    
-    ${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS}
-
-    if test x$? = x0; then
-	[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-	$MAKE  > /dev/null 2>>test_log
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok "make..."; 
-	else
-	    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-	    return 1
-	fi
-	
-    else
-	[ -z "$quiet" ] &&       log_msg_fail "configure...";
-	return 1
-    fi
-    
-    
-    #####################################################################
-    #
-    #
-    rm -f ./.samhain_file
-    rm -f ./.samhain_log
-    rm -f ./.samhain_lock
-    rm -f ./rc.${SH_LOCALHOST}
-    rm -f ./file.${SH_LOCALHOST}
-    
-    cp ${SCRIPTDIR}/testrc_2.in testrc_2
-    
-    ./samhain.build -t init -p none
-    
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "init...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "init...";
-	return 1
-    fi
-    
-    # Create a password
-
-    SHPW=`./yule -G`
-    if test x"$SHPW" = x; then
-	[ -z "$quiet" ]   && log_msg_fail  "password not generated -- aborting"
-	return 1
-    fi
-    
-    # Set in client
-    
-    ./samhain_setpwd samhain.build new $SHPW >/dev/null
-    
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "./samhain_setpwd samhain.build new $SHPW";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "./samhain_setpwd samhain.build new $SHPW";
-	return 1
-    fi
-    
-    mv samhain.build.new  samhain.new || return 1
-    
-    rm -f ./.samhain_log*
-    rm -f ./.samhain_lock
-    
-    SHCLT=`./yule -P $SHPW`
-    
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "yule -P $SHPW";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "yule -P $SHPW";
-	return 1
-    fi
-    
-    SHCLT1=`echo "${SHCLT}"  | sed s%HOSTNAME%${SH_LOCALHOST}%`
-    AHOST=`find_hostname`
-    SHCLT2=`echo "${SHCLT}"  | sed s%HOSTNAME%${AHOST}%`
-	
-
-    echo $SHCLT1 >> testrc_2
-    echo $SHCLT2 >> testrc_2
-
-    
-    cp    "${RCFILE_C}"              ./rc.${SH_LOCALHOST}
-    mv    $PW_DIR/.samhain_file.asc  ./file.${SH_LOCALHOST}
-
-    ALTHOST=`find_hostname`
-    cp    "${RCFILE_C}"          "./rc.${ALTHOST}"
-    cp    ./file.${SH_LOCALHOST} "./file.${ALTHOST}" 2>/dev/null
-}
-
-MAXTEST=1; export MAXTEST
+fi
+
+echo
 
 testrun2b ()
 {
-    log_start "RUN FULL CLIENT/SERVER W/GPG";
-    #
-    if [ x"$1" = x ]; then
-	[ -z "$quiet" ] && log_msg_fail "Missing hostname"
+	#
+	# test standalone compilation
+	#
+	echo "${S}Building client and server${E}"; echo;
+	#
+	if test -r "Makefile"; then
+		$MAKE distclean
+	fi
+        #
+        GPG_HASH=`${GPG_PATH} --load-extension tiger --print-md TIGER192 ${GPG_PATH}`
+        #
+        echo GPG_HASH is ${GPG_HASH}
+        #
+	${TOP_SRCDIR}/configure --quiet  $TRUST --with-gpg=${GPG_PATH} --enable-xml-log --enable-network=client --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2.signed --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock 
+	#
+	if test x$? = x0; then
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
+		if test x$? = x0; then
+		    echo "$MAKE completed, exit status $?"; echo;
+		else
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
+		fi
+
+	else
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
+	fi
+
+	# save binary and build server
+	#
+	cp samhain samhain.build
+	make clean
+
+        #
+	${TOP_SRCDIR}/configure --quiet  $TRUST --with-gpg=${GPG_PATH} --enable-xml-log ${TEST_MYSQL} --enable-debug --enable-network=server --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2.signed --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 --enable-identity=rainer
+	#
+	if test x$? = x0; then
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
+		if test x$? = x0; then
+		    echo "$MAKE completed, exit status $?"; echo;
+		else
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
+		fi
+
+	else
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
+	fi
+	echo "${S}Initialize database${E}"; echo;
+
+	rm -f ./.samhain_file
+	rm -f ./.samhain_log
+	rm -f ./.samhain_lock
+	rm -f ./rc.${SH_LOCALHOST}
+	rm -f ./file.${SH_LOCALHOST}
+
+	cp ${SCRIPTDIR}/testrc_2.in testrc_2.signed
+
+	# Create a password
+	SHPW=`./yule -G`
+	if test x"$SHPW" = x; then
+	    echo "password not generated -- aborting"
+	    exit 1
+	fi
+
+	# Set in client
+	echo "./samhain_setpwd samhain.build new $SHPW"
+	./samhain_setpwd samhain.build new $SHPW
+	mv samhain.build.new samhain.new
+	SHCLT=`./yule -P $SHPW | sed s%HOSTNAME%${SH_LOCALHOST}%`
+ 	echo $SHCLT >> testrc_2.signed
+
+        echo "--- You need to sign the config file testrc_2.signed now ---"
+        echo
+        ${GPG_PATH} -a --clearsign --not-dash-escaped $PW_DIR/testrc_2.signed
+        mv $PW_DIR/testrc_2.signed.asc $PW_DIR/testrc_2.signed
+
+	echo "./samhain.new -t init"
+	./samhain.new -t init
+
+	SHINI=$?
+
+	rm -f ./.samhain_log
+	rm -f ./.samhain_lock
+
+	cp    ./testrc_2.signed       ./rc.${SH_LOCALHOST}
+	mv    ./.samhain_file         ./file.${SH_LOCALHOST}
+
+	if test x$SHINI = x0; then
+                echo
+                echo "--- You need to sign the database file.${SH_LOCALHOST} now ---"
+                echo
+                ${GPG_PATH} -a --clearsign --not-dash-escaped $PW_DIR/file.${SH_LOCALHOST}
+                mv $PW_DIR/file.${SH_LOCALHOST}.asc $PW_DIR/file.${SH_LOCALHOST}
+
+		echo; echo "${S}Start Server${E}: ./yule  &"; echo;
+		./yule &
+		PROC_Y=$!
+		sleep 5
+
+		echo; echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check";
+
+		./samhain.new -t check -p none -l none -e info 
+		if test x$? = x0; then
+		    echo "${S}check completed${E}"
+		else
+		    echo "${S}ERROR:${E} -- check -- failed, exit status $?"
+		    echo
+		    kill $PROC_Y
+		    exit
+		fi
+
+		kill $PROC_Y
+		sleep 5
+	else
+		echo "${S}ERROR:${E} -- init -- failed, exit status $SHINI"; 
+		echo;
+		exit
+	fi
+	    
+}
+
+    if test x$1 = x; then
+	echo
+	echo "Please provide the local hostname as argument."
+	echo
+	exit 8
     fi
-    #
-    GPG=`find_path gpg`
-    if [ -z "$GPG" ]; then
-	log_skip 1 $MAXTEST 'gpg not found in $PATH'
-    else
-	eval "$GPG" --list-keys 0F571F6C >/dev/null 2>/dev/null
-	if [ $? -ne 0 ]; then
-	    log_skip 1 $MAXTEST 'public PGP key 0x0F571F6C not present'
-	else
-	    
-	    SH_LOCALHOST=$1; export SH_LOCALHOST
-    
-	    testrun2b_internal "$GPG"
-
-	    SAVE_VALGRIND="${VALGRIND}"; VALGRIND=''; export VALGRIND
-	    do_test_1_a
-	    VALGRIND="${SAVE_VALGRIND}"; export VALGRIND 
-	    if [ $? -eq 0 ]; then
-		[ -z "$quiet" ] && log_ok   1 ${MAXTEST} "Client download+logging w/gpg";
-	    else
-		[ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client download+logging w/gpg";
-	    fi
-    
-	    if [ -n "$cleanup" ]; then
-		rm -f ./rc.${SH_LOCALHOST}
-		rm -f ./file.${SH_LOCALHOST}
-		ALTHOST=`find_hostname`
-		rm -f "./file.${ALTHOST}"
-		rm -f "./rc.${ALTHOST}"
-	    fi
-	fi
-    fi
-    log_end "RUN FULL CLIENT/SERVER W/GPG"
-}
-
+
+    SH_LOCALHOST=$1; export SH_LOCALHOST
+
+    testrun2b
+
+
+echo; echo "${S}__ END TEST RUN CLIENT/SERVER W/GPG __${E}"; echo;
+
+exit
+
Index: trunk/test/testrun_2c.sh
===================================================================
--- trunk/test/testrun_2c.sh	(revision 591)
+++ trunk/test/testrun_2c.sh	(revision 1)
@@ -1,427 +1,189 @@
 #! /bin/sh
 
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-RCFILE="$PW_DIR/testrc_2";  export RCFILE
-HTML="$PW_DIR/yule.html";  export HTML
 
-SERVER_BUILDOPTS="--quiet  $TRUST --enable-xml-log --enable-debug --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 --with-database=mysql"; export SERVER_BUILDOPTS
+# The following two are the ANSI sequences for start and end embolden
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
 
-CLIENT_BUILDOPTS="--quiet  $TRUST --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
+PW_DIR=`pwd`
 
-MAXTEST=4; export MAXTEST
+if test x$UID != x; then
+  TRUST="--with-trusted=0,2,$UID"
+else
+  TRUST="--with-trusted=0,2"
+fi
 
-do_test_1_c () {
+echo; echo "${S}__ STARTING TEST RUN CLIENT/SERVER W/MYSQL __${E}"; echo;
+echo Working directory: $PW_DIR
 
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Server${E}: ./yule -l info -p none &"; 
-	    echo; 
-	}
+MAKE=`which gmake`
+if test "x$?" = x1 ; then
+    MAKE="make -s"
+else
+    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$MAKE" = x; then
+	MAKE="make -s"
+    elif test "x$MAKE" = xno; then
+	MAKE="make -s"
+    else
+	if test "x$MAKE" = "xwhich:"; then
+		MAKE="make -s"
+	else
+		MAKE="gmake -s"
+		gmake -v >/dev/null 2>&1 || MAKE="make -s"
+	fi
+    fi
+fi
 
-	rm -f test_log_valgrind
+echo MAKE is $MAKE
+echo
 
-	${VALGRIND} ./yule.2 -q -l info -p none >/dev/null 2>>test_log_valgrind &
-	PROC_Y2=$!
-	five_sec_sleep
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Server #2${E}: ./yule.2 -l info -p none &"; 
-	    echo; 
-	}
-
-	${VALGRIND} ./yule -l info -p none -e info --bind-address=127.0.0.1 \
-	    --server-port=49778 >/dev/null 2>>test_log_valgrind &
-	PROC_Y=$!
-	five_sec_sleep
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check"; 
-	    echo; 
-	}
-
-	${VALGRIND} ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 >/dev/null 2>>test_log_valgrind
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "samhain.new -t check";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "samhain.new -t check";
-	    kill $PROC_Y
-	    kill $PROC_Y2
-	    return 1
-	fi
-
-	kill $PROC_Y
-	kill $PROC_Y2
-	five_sec_sleep
-
-	# cp ${LOGFILE}  triple_test
-	# cp ${LOGFILE}2 triple_test_2
-
-	egrep "START(>|\").*Yule(>|\")" ${LOGFILE}2 >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server #2 start";
-	    return 1
-	fi
-	egrep "remote_host.*Checking.*/bin" ${LOGFILE}2 >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (relayed)";
-	    return 1
-	fi
-	egrep "remote_host.*EXIT.*Samhain" ${LOGFILE}2 >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client exit (relayed)";
-	    return 1
-	fi
-	egrep "EXIT.*Yule.*SIGTERM" ${LOGFILE}2 >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server #2 exit";
-	    return 1
-	fi
-
-
-	egrep "START(>|\").*Yule(>|\")" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server start";
-	    return 1
-	fi
-	egrep "NEW CLIENT" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client connect";
-	    return 1
-	fi
-	egrep "remote_host.*Checking.*/bin" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check";
-	    return 1
-	fi
-	egrep "remote_host.*EXIT.*Samhain" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client exit";
-	    return 1
-	fi
-	egrep "EXIT.*Yule.*SIGTERM" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Server exit";
-	    return 1
-	fi
-
-	[ -z "$VALGRIND" ] || {
-	    tmp=`cat test_log_valgrind 2>/dev/null | wc -l`;
-	    if [ $tmp -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "valgrind reports errors";
-		cat test_log_valgrind
-		return 1;
-	    fi;
-	}
-
-	return 0
-}
-
-testrun_threesockets () {
-
-    GPG="$1"
-
-    [ -z "$verbose" ] || { 
-        echo; 
-        echo Working directory: $PW_DIR; echo MAKE is $MAKE; echo GPG is $GPG;
-        echo; 
-    }
-
-    [ -z "$verbose" ] || { echo; echo "${S}Building client and server${E}"; echo; }
-
-    if test -r "Makefile"; then
-        $MAKE distclean
-    fi
-
-    ${TOP_SRCDIR}/configure --with-gpg=${GPG} --with-fp=EF6CEF54701A0AFDB86AF4C31AAD26C80F571F6C --with-checksum=no ${SERVER_BUILDOPTS} >/dev/null 2>&1
-
-    if test x$? = x0; then
-        [ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-        $MAKE  > /dev/null 2>>test_log
-        if test x$? = x0; then
-            [ -z "$verbose" ] || log_msg_ok "make..."; 
-        else
-            [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-            return 1
-        fi
-    else
-        [ -z "$quiet" ] &&       log_msg_fail "configure...";
-        return 1
-    fi
-
-    rm -f ./.samhain_file
-    rm -f ./.samhain_log
-    rm -f ./.samhain_lock
-    rm -f ./rc.${SH_LOCALHOST}
-    rm -f ./file.${SH_LOCALHOST}
-    
-    cp ${SCRIPTDIR}/testrc_2.in testrc_2
-    
-    ORIGINAL="DatabaseSeverity=none"
-    REPLACEMENT="DatabaseSeverity=warn"
-    ex -s $RCFILE <<EOF
-%s/$ORIGINAL/$REPLACEMENT/g
-wq
-EOF
-
-    ORIGINAL="MailSeverity=none"
-    REPLACEMENT="MailSeverity=crit"
-    ex -s $RCFILE <<EOF
-%s/$ORIGINAL/$REPLACEMENT/g
-wq
-EOF
-    return 0
- }
-
-check_mysql_log () {
-    DATE="$1"
-
-    rm -f test_log_db
-    #
-    echo "SELECT * FROM log WHERE entry_status = 'NEW' and log_time > '"${DATE}"';" | mysql --password=samhain -u samhain samhain >test_log_db
-    #
-    egrep "START.*Yule" test_log_db >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Server start";
-	return 1
-    fi
-    egrep "NEW CLIENT" test_log_db >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Client connect";
-	return 1
-    fi
-    egrep "Checking.*/bin" test_log_db >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Client file check";
-	return 1
-    fi
-    egrep "EXIT.*Samhain" test_log_db >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Client exit";
-	return 1
-    fi
-    egrep "EXIT.*Yule.*SIGTERM" test_log_db >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Server exit";
-	return 1
-    fi
-    return 0
-}
 
 testrun2c ()
 {
-    log_start "RUN FULL CLIENT/SERVER W/MYSQL"
-    #
-    if [ -z "$doall" ]; then
-	log_skip 1 $MAXTEST 'Client/server w/mysql (or use --really-all)'
-	log_skip 2 $MAXTEST 'Client/server w/mysql (or use --really-all)'
-	log_skip 3 $MAXTEST 'Client/server w/mysql (or use --really-all)'
-	log_skip 4 $MAXTEST 'Client/server w/mysql (or use --really-all)'
-	return 0
-    fi
-    if [ x"$1" = x ]; then
-	[ -z "$quiet" ] && log_msg_fail "Missing hostname"
-    fi
-    MYSQL=`find_path mysql`
-    if [ -z "$MYSQL" ]; then
-	log_skip 1 $MAXTEST "mysql not found";
-	log_skip 2 $MAXTEST "mysql not found";
-	log_skip 3 $MAXTEST "mysql not found";
-	log_skip 4 $MAXTEST "mysql not found";
-	return 1
-    else
-	TEST=`echo "DESCRIBE log;" | mysql --password=samhain -u samhain samhain 2>/dev/null`
-	if [ $? -ne 0 -o -z "$TEST" ]; then
-	    log_skip 1 $MAXTEST "mysql not default setup"
-	    log_skip 2 $MAXTEST "mysql not default setup"
-	    log_skip 3 $MAXTEST "mysql not default setup"
-	    log_skip 4 $MAXTEST "mysql not default setup"
-	    return 1
+	#
+	# test standalone compilation
+	#
+	echo "${S}Building client and server${E}"; echo;
+	#
+	if test -r "Makefile"; then
+		$MAKE distclean
 	fi
-    fi
-    #
-    SH_LOCALHOST=$1; export SH_LOCALHOST
-    #
-    DATE=`date '+%Y-%m-%d %T'`
-    #
-    testrun2a_internal
-    #
-    # BUILD Server 2
-    #
-    cp ./yule ./yule.orig
+        #
+        #
+	# ${TOP_SRCDIR}/configure --quiet  $TRUST --enable-login-watch --enable-xml-log --enable-debug --enable-network=client --enable-srp --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=localhost  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock
+	#
+	${TOP_SRCDIR}/configure --prefix=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-timeserver=localhost --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock
+	#
+	#
+	if test x$? = x0; then
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
+		if test x$? = x0; then
+		    echo "$MAKE completed, exit status $?"; echo;
+		else
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
+		fi
 
-    ${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=server  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=${RCFILE}2  --with-log-file=${LOGFILE}2 --with-pid-file=$PW_DIR/.samhain_lock2 --with-html-file=${HTML}2 --with-state-dir=$PW_DIR --with-port=49778 --with-database=mysql
-    #
-    if test x$? = x0; then
-	[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-	$MAKE  > /dev/null 2>>test_log
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok "make..."; 
 	else
-	    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-	    return 1
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
 	fi
 
-    else
-	[ -z "$quiet" ] &&       log_msg_fail "configure...";
-	return 1
-    fi
-    
-    cp yule yule.2 || return 1
-    #
-    cp ./yule.orig ./yule
-    #
-    SHPW=`cat ./testpw`
-    
-    if test x"$SHPW" = x; then
-	[ -z "$quiet" ]   && log_msg_fail  "password not generated -- aborting"
-	return 1
-    fi
-    
-    rm -f ./testpw
-    
-    ./samhain_setpwd yule new $SHPW >/dev/null
-    
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "./samhain_setpwd yule new $SHPW";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "./samhain_setpwd yule new $SHPW";
-	return 1
+	# save binary and build server
+	#
+	cp samhain samhain.build
+	make clean
+
+        #
+	${TOP_SRCDIR}/configure --quiet  $TRUST --enable-xml-log --enable-debug --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 --with-database=mysql  
+
+#  --enable-login-watch --enable-mounts-check --enable-userfiles  --enable-identity=yule --enable-suidcheck --with-gpg=/usr/local/bin/gpg --with-fp="EF6C EF54 701A 0AFD B86A  F4C3 1AAD 26C8 0F57 1F6C"
+
+	#
+        # --with-database=mysql --with-libs=-L/usr/local/mysql/lib 
+	# --with-database=postgresql
+	#
+	if test x$? = x0; then
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
+		if test x$? = x0; then
+		    echo "$MAKE completed, exit status $?"; echo;
+		else
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
+		fi
+
+	else
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
+	fi
+	echo "${S}Initialize database${E}"; echo;
+
+	rm -f ./.samhain_file
+	rm -f ./.samhain_log
+	rm -f ./.samhain_lock
+	rm -f ./rc.${SH_LOCALHOST}
+	rm -f ./file.${SH_LOCALHOST}
+
+	cp ${SCRIPTDIR}/testrc_2.in testrc_2
+
+	# Create a password
+	SHPW=`./yule -G`
+	if test x"$SHPW" = x; then
+	    echo "password not generated -- aborting"
+	    exit 1
+	fi
+
+	# Set in client
+	echo "./samhain_setpwd samhain.build new $SHPW"
+	./samhain_setpwd samhain.build new $SHPW
+	mv samhain.build.new samhain.new
+	SHCLT=`./yule -P $SHPW | sed s%HOSTNAME%${SH_LOCALHOST}%`
+ 	echo $SHCLT >> testrc_2
+
+	echo "./samhain.new -t init"
+	./samhain.new -t init
+
+	SHINI=$?
+
+	rm -f ./.samhain_log
+	rm -f ./.samhain_lock
+
+	cp    ./testrc_2              ./rc.${SH_LOCALHOST}
+	mv    ./.samhain_file         ./file.${SH_LOCALHOST}
+
+	if test x$SHINI = x0; then
+
+		echo; echo "${S}Start Server${E}: ./yule  &"; echo;
+		./yule &
+		PROC_Y=$!
+		sleep 5
+
+		echo; echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check";
+
+		./samhain.new -t check -p none -l none -e info 
+		if test x$? = x0; then
+		    echo "${S}check completed${E}"
+		else
+		    echo "${S}ERROR:${E} -- check -- failed, exit status $?"
+		    echo
+		    kill $PROC_Y
+		    exit
+		fi
+
+		kill $PROC_Y
+		sleep 5
+	else
+		echo "${S}ERROR:${E} -- init -- failed, exit status $SHINI"; 
+		echo;
+		exit
+	fi
+	    
+}
+
+    if test x$1 = x; then
+	echo
+	echo "Please provide the local hostname as argument."
+	echo
+	exit 8
     fi
 
+    SH_LOCALHOST=$1; export SH_LOCALHOST
 
-    $MAKE clean >/dev/null || return 1
-    mv yule.new yule || return 1
-    #
-    ORIGINAL="DatabaseSeverity=none"
-    REPLACEMENT="DatabaseSeverity=info"
-    ex -s $RCFILE <<EOF
-%s/$ORIGINAL/$REPLACEMENT/g
-wq
-EOF
-    #
-    do_test_1_a
-    #
-    if [ $? -ne 0 ]; then
-	[ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client/server w/mysql";
-    else
-    #
-	check_mysql_log "${DATE}"
-	if [ $? -ne 0 ]; then
-	    [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client/server w/mysql";
-	else
-	    [ -z "$quiet" ] && log_ok   1 ${MAXTEST} "Client/server w/mysql";
-	fi
-    fi
-    #
-    cp testrc_2 testrc_22
-    ORIGINAL="DatabaseSeverity=none"
-    REPLACEMENT="DatabaseSeverity=info"
-    ex -s $RCFILE <<EOF
-%s/$REPLACEMENT/$ORIGINAL/g
-wq
-EOF
-    #
-    do_test_1_c
-    #
-    if [ $? -ne 0 ]; then
-	[ -z "$quiet" ] && log_fail 2 ${MAXTEST} "Client/server (relay) w/mysql";
-    else
-    #
-	check_mysql_log "${DATE}"
-	if [ $? -ne 0 ]; then
-	    [ -z "$quiet" ] && log_fail 2 ${MAXTEST} "Client/server (relay) w/mysql";
-	else
-	    [ -z "$quiet" ] && log_ok   2 ${MAXTEST} "Client/server (relay) w/mysql";
-	fi
-    fi
-    #
-    #
-    if [ -f ./yule ]; then
-	./yule -p info -l info --set-database-severity=info -D >/dev/null 2>>test_log 
-	five_sec_sleep
-	netstat -pant 2>/dev/null | grep 49777 | grep yule >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$quiet" ] && log_fail 3 ${MAXTEST} "Client/server w/mysql";
-	else
-	    NSOCK=`netstat -pand 2>/dev/null | grep STREAM | grep yule | wc -l`
-	    if [ $NSOCK -ne 2 ]; then
-		[ -z "$quiet" ] && log_fail 3 ${MAXTEST} "Three sockets open";
-		netstat -pand 2>/dev/null | grep yule 
-	    else
-		[ -z "$quiet" ] && log_ok   3 ${MAXTEST} "Three sockets open";
-	    fi
-	fi
-	PID=`cat .samhain_lock`
-	kill $PID
-    else
-	log_fail 3 ${MAXTEST} "Three sockets open";
-    fi
-    #
-    cp ${SCRIPTDIR}/testrc_2.in testrc_2
-    #
-    GPG=`find_path gpg`
-    if [ -z "$GPG" ]; then
-        log_skip 4 $MAXTEST 'gpg not found in $PATH'
-    else
-        eval "$GPG" --list-keys 0F571F6C >/dev/null 2>/dev/null
-        if [ $? -ne 0 ]; then
-            log_skip 4 $MAXTEST 'public PGP key 0x0F571F6C not present'
-        else
-	    testrun_threesockets "$GPG"
-	    #
-	    cp ${SCRIPTDIR}/testrc_2.in testrc_2
-	    #
-	    if [ -f ./yule ]; then
-		./yule -D --set-database-severity=warn >/dev/null 2>>test_log 
-		five_sec_sleep
-		netstat -pant 2>/dev/null | grep 49777 | grep yule >/dev/null 2>&1
-		if [ $? -ne 0 ]; then
-		    [ -z "$quiet" ] && log_fail 4 ${MAXTEST} "Three sockets open (gpg) - 1";
-		else
-		    NSOCK=`netstat -pand 2>/dev/null | grep STREAM | grep yule | wc -l`
-		    if [ $NSOCK -ne 2 ]; then
-			[ -z "$quiet" ] && log_fail 4 ${MAXTEST} "Three sockets open (gpg) - 2";
-			netstat -pand 2>/dev/null | grep yule 
-		    else
-			[ -z "$quiet" ] && log_ok   4 ${MAXTEST} "Three sockets open (gpg)";
-		    fi
-		fi
-		PID=`cat .samhain_lock`
-		kill $PID
-	    else
-		log_fail 4 ${MAXTEST} "Three sockets open (gpg) - 3";
-	    fi
-	fi
-    fi
-    #
-    if [ -n "$cleanup" ]; then
-	rm -f ./rc.${SH_LOCALHOST}
-	rm -f ./file.${SH_LOCALHOST}
-	ALTHOST=`find_hostname`
-	rm -f "./file.${ALTHOST}"
-	rm -f "./rc.${ALTHOST}"
-    fi
-    #
-    log_end "RUN FULL CLIENT/SERVER W/MYSQL"
-}
+    testrun2c
 
+
+echo; echo "${S}__ END TEST RUN CLIENT/SERVER W/MYSQL __${E}"; echo;
+
+exit
+
Index: trunk/test/testrun_2d.sh
===================================================================
--- trunk/test/testrun_2d.sh	(revision 591)
+++ trunk/test/testrun_2d.sh	(revision 1)
@@ -1,150 +1,190 @@
 #! /bin/sh
 
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
 
-SERVER_BUILDOPTS="--quiet  $TRUST --enable-xml-log --enable-debug --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 --with-database=postgresql"; export SERVER_BUILDOPTS
+# The following two are the ANSI sequences for start and end embolden
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
 
-CLIENT_BUILDOPTS="--quiet  $TRUST --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
+PW_DIR=`pwd`
 
-create_pgpass () {
-touch ~/.pgpass
-chmod 600 ~/.pgpass
-cat > ~/.pgpass << EOF
-localhost:*:samhain:samhain:samhain
-EOF
-}
+if test x$UID != x; then
+  TRUST="--with-trusted=0,2,$UID"
+else
+  TRUST="--with-trusted=0,2"
+fi
 
-check_psql_log () {
-    DATE="$1"
+echo; echo "${S}__ STARTING TEST RUN CLIENT/SERVER __${E}"; echo;
+echo Working directory: $PW_DIR
 
-    rm -f test_log_db
-    # PGPASSWORD=samhain; export PGPASSWORD
-    create_pgpass
-    psql -h localhost -o test_log_db -U samhain -d samhain -c "SELECT * FROM log WHERE entry_status = 'NEW' and log_time > '${DATE}';"
-    #
-    egrep "START.*Yule" test_log_db >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Server start (psql) DATE ${DATE}";
-	return 1
+MAKE=`which gmake`
+if test "x$?" = x1 ; then
+    MAKE="make -s"
+else
+    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$MAKE" = x; then
+	MAKE="make -s"
+    elif test "x$MAKE" = xno; then
+	MAKE="make -s"
+    else
+	if test "x$MAKE" = "xwhich:"; then
+		MAKE="make -s"
+	else
+		MAKE="gmake -s"
+		gmake -v >/dev/null 2>&1 || MAKE="make -s"
+	fi
     fi
-    egrep "NEW CLIENT" test_log_db >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Client connect (psql)";
-	return 1
-    fi
-    egrep "Checking.*/bin" test_log_db >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Client file check (psql)";
-	return 1
-    fi
-    egrep "EXIT.*Samhain" test_log_db >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Client exit (psql)";
-	return 1
-    fi
-    egrep "EXIT.*Yule.*SIGTERM" test_log_db >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	[ -z "$verbose" ] || log_msg_fail "Server exit (psql)";
-	return 1
-    fi
-    return 0
-}
+fi
 
-MAXTEST=1; export MAXTEST
+echo MAKE is $MAKE
+echo
+
+# --with-database=postgresql
+# export MYLIB=-L/usr/local/pgsql/lib
+# export MYINC=-I/usr/local/pgsql/include
+# export LD_LIBRARY_PATH=/usr/local/pgsql/lib
+
+# --with-database=mysql
+# export MYLIB=-L/usr/local/mysql/lib
+# export MYINC=-I/usr/local/mysql/include
+# export LD_LIBRARY_PATH=/usr/local/mysql/lib
 
 testrun2d ()
 {
-    log_start "RUN FULL CLIENT/SERVER W/POSTGRESQL"
-    #
-    if [ -z "$doall" ]; then
-	log_skip 1 $MAXTEST 'Client/server w/postgresql (or use --really-all)'
-	return 0
-    fi
-    if [ x"$1" = x ]; then
-	[ -z "$quiet" ] && log_msg_fail "Missing hostname"
-    fi
-    PSQL=`find_path psql`
-    if [ -z "$PSQL" ]; then
-	log_skip 1 $MAXTEST "psql not found";
-	return 1
-    else
-	# PGPASSWORD="samhain"; export PGPASSWORD
-	create_pgpass
-	TEST=`psql -h localhost -U samhain -d samhain -c "SELECT * FROM log LIMIT 1;" 2>/dev/null`
-	if [ $? -ne 0 -o -z "$TEST" ]; then
-	    log_skip 1 $MAXTEST "psql not default setup"
-	    return 1
+	#
+	# test standalone compilation
+	#
+	echo "${S}Building client and server${E}"; echo;
+	#
+	if test -r "Makefile"; then
+		$MAKE distclean
 	fi
-    fi
-    #
-    SH_LOCALHOST=$1; export SH_LOCALHOST
-    #
-    DATE=`date '+%Y-%m-%d %T'`
-    #
-    testrun2a_internal
-    #
-    for ff in ./rc.*; do
-    ORIGINAL="SetUdpActive=no"
-    REPLACEMENT="ReportCheckflags=yes"
-    ex -s rc.morrigan.localdomain <<EOF
-%s/$ORIGINAL/$REPLACEMENT/g
-wq
-EOF
-    done
-    #
-    ORIGINAL="DatabaseSeverity=none"
-    REPLACEMENT="DatabaseSeverity=info"
-    ex -s $RCFILE <<EOF
-%s/$ORIGINAL/$REPLACEMENT/g
-wq
-EOF
-    #
-    ORIGINAL="# setdbname=samhain"
-    REPLACEMENT="setdbhost=127.0.0.1"
-    ex -s $RCFILE <<EOF
-%s/$ORIGINAL/$REPLACEMENT/g
-wq
-EOF
-    #
-    do_test_1_a
-    #
-    if [ $? -ne 0 ]; then
-	[ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client/server w/postgresql";
-    else
-    #
-	check_psql_log "${DATE}"
-	if [ $? -ne 0 ]; then
-	    [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client/server w/postgresql";
+	#
+	${TOP_SRCDIR}/configure --quiet  $TRUST --enable-network=client  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/testrc_2  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file
+	#
+	if test x$? = x0; then
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
+		if test x$? = x0; then
+		    echo "$MAKE completed, exit status $?"; echo;
+		else
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
+		fi
+
 	else
-	    [ -z "$quiet" ] && log_ok   1 ${MAXTEST} "Client/server w/postgresql";
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
 	fi
-    fi
-    #
-    if [ -n "$cleanup" ]; then
-	rm -f ./rc.${SH_LOCALHOST}
-	rm -f ./file.${SH_LOCALHOST}
-	ALTHOST=`find_hostname`
-	rm -f "./file.${ALTHOST}"
-	rm -f "./rc.${ALTHOST}"
-    fi
-    #
-    log_end "RUN FULL CLIENT/SERVER W/POSTGRESQL"
+
+	# save binary and build server
+	#
+	cp samhain samhain.build
+	make clean
+
+	${TOP_SRCDIR}/configure --quiet  $TRUST --enable-network=server  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/testrc_2  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file --enable-udp --enable-identity=rainer
+	#
+	if test x$? = x0; then
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
+		if test x$? = x0; then
+		    echo "$MAKE completed, exit status $?"; echo;
+		else
+		    echo "${S}ERROR:${E} make failed, exit status $?"; echo;
+		    exit
+		fi
+
+	else
+		echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
+		exit
+	fi
+
+	#################################################################
+	#
+	#
+	echo "${S}Initialize database${E}"; echo;
+
+	rm -f ./.samhain_file
+	rm -f ./.samhain_log
+	rm -f ./.samhain_lock
+
+	cp ${SCRIPTDIR}/testrc_2.in testrc_2
+
+	echo "./samhain.build -t init"
+	./samhain.build -t init
+
+	SHINI=$?
+
+	# Create a password
+
+	SHPW=`./yule -G 2>&1 | grep -v 'ERRO'`
+	if test x"$SHPW" = x; then
+	    echo "password not generated -- aborting"
+	    exit 1
+	fi
+
+	# Set in client
+
+	echo "./samhain_setpwd samhain.build new $SHPW"
+	./samhain_setpwd samhain.build new $SHPW
+
+	mv samhain.build.new  samhain.new
+
+	rm -f ./.samhain_log
+	rm -f ./.samhain_lock
+
+	SHCLT=`./yule -P $SHPW  2>&1 | grep -v 'ERRO' | sed s%HOSTNAME%${SH_LOCALHOST}%`
+
+ 	echo $SHCLT >> testrc_2
+
+	if test x$SHINI = x0; then
+		echo; echo "${S}Start Server${E}: ./yule  &"; echo;
+		su -c "./yule &"
+		PROC_Y=$!
+		sleep 5
+
+		echo; echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check";
+
+		./samhain.new -t check -p none -l none -e info
+		if test x$? = x0; then
+		    echo "${S}check completed${E}"
+		else
+		    echo "${S}ERROR:${E} -- check -- failed, exit status $?"
+		    echo
+		    su -c "kill $PROC_Y"
+		    exit
+		fi
+
+		su -c "kill $PROC_Y"
+		sleep 5
+	else
+		echo "${S}ERROR:${E} -- init -- failed, exit status $SHINI"; 
+		echo;
+		exit
+	fi
+	    
 }
 
+    if test x$1 = x; then
+	echo
+	echo "Please provide the local hostname as argument."
+	echo
+	exit 8
+    fi
+
+    SH_LOCALHOST=$1; export SH_LOCALHOST
+
+    testrun2d
+
+
+echo; echo "${S}__ END TEST RUN CLIENT/SERVER __${E}"; echo;
+
+exit
+
Index: trunk/test/testrun_2e.sh
===================================================================
--- trunk/test/testrun_2e.sh	(revision 591)
+++ 	(revision )
@@ -1,299 +1,0 @@
-#! /bin/sh
-
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-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 --enable-debug=gdb"; 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-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --enable-debug"; export CLIENT_BUILDOPTS
-
-do_test_2_e () {
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Server${E}: ./yule -l info -p none &"; 
-	    echo; 
-	}
-	rm -f test_log_valgrind
-
- 	# SetSocketAllowUid=$(id -u)
-	#
-	if test -f /usr/xpg4/bin/id; then
-	    MY_ID=$(/usr/xpg4/bin/id -u)
-	else
-	    MY_ID=$(id -u)
-	fi
-	#
-	sed -i -e "s/SetSocketAllowUid=0/SetSocketAllowUid=${MY_ID}/g" $RCFILE
-
-	# Start server
-	#
-	${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind &
-	PROC_Y=$!
-	five_sec_sleep
-
-	./yulectl -c LIST >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c LIST (1)";
-	    kill $PROC_Y
-	    return 1
-	fi	
-	NR=$( ./yulectl -c LIST | wc -l )
-	if [ $NR -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c LIST (2)";
-	    kill $PROC_Y
-	    return 1
-	fi
-
-	./yulectl -c SCAN localhost.localdomain
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c SCAN";
-	    kill $PROC_Y
-	    return 1
-	fi
-
-	UUID=$(uuidgen)
-	./yulectl -c DELTA:$UUID localhost.localdomain
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c DELTA:$UUID";
-	    kill $PROC_Y
-	    return 1
-	fi
-
-	./yulectl -c RELOAD localhost.localdomain
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c RELOAD";
-	    kill $PROC_Y
-	    return 1
-	fi
-
-	./yulectl -c LIST >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c LIST (3)";
-	    kill $PROC_Y
-	    return 1
-	fi	
-	NR=$( ./yulectl -c LIST | wc -l )
-	if [ $NR -ne 3 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c LIST (4)";
-	    kill $PROC_Y
-	    return 1
-	fi
-	
-	{ ./yulectl -c LIST | head -n 1 | grep SCAN; } >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c LIST (5)";
-	    kill $PROC_Y
-	    return 1
-	fi	
-	{ ./yulectl -c LIST | tail -n 1 | grep RELOAD; } >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c LIST (6)";
-	    kill $PROC_Y
-	    return 1
-	fi	
-	{ ./yulectl -c LIST | tail -n 2 | head -n 1| grep "DELTA:$UUID"; } >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c LIST (7)";
-	    kill $PROC_Y
-	    return 1
-	fi
-
-	./yulectl -c CANCEL localhost.localdomain
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c CANCEL";
-	    kill $PROC_Y
-	    return 1
-	fi
-	
-	./yulectl -c LIST >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c LIST (8)";
-	    kill $PROC_Y
-	    return 1
-	fi	
-	NR=$( ./yulectl -c LIST | wc -l )
-	if [ $NR -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "./yulectl -c LIST (9)";
-	    kill $PROC_Y
-	    return 1
-	fi
-
-	kill $PROC_Y
-	return 0
-}
-
-testrun2e_internal ()
-{
-        [ -z "$verbose" ] || { 
-	    echo; 
-	    echo Working directory: $PW_DIR; echo MAKE is $MAKE; 
-	    echo; 
-	}
-	#
-	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building client and server${E}"; echo; }
-	#
-	if test -r "Makefile"; then
-		$MAKE distclean
-	fi
-	#
-	${TOP_SRCDIR}/configure ${CLIENT_BUILDOPTS}
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE > /dev/null 2>>test_log
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	# save binary and build server
-	#
-	cp samhain samhain.build || return 1
-	$MAKE clean >/dev/null || return 1
-
-	${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS}
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  > /dev/null 2>>test_log
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-
-	#####################################################################
-	#
-	#
-	rm -f ./.samhain_file
-	rm -f ./.samhain_log
-	rm -f ./.samhain_lock
-	rm -f ./rc.${SH_LOCALHOST}
-	rm -f ./file.${SH_LOCALHOST}
-	rm -f  "./rc.${ALTHOST}"
-	rm -f  "./file.${ALTHOST}"
-
-	cp ${SCRIPTDIR}/testrc_2.in testrc_2
-
-	./samhain.build -t init -p none
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "init...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "init...";
-	    return 1
-	fi
-
-	# Create a password
-
-	SHPW=`./yule -G`
-	if test x"$SHPW" = x; then
-	    [ -z "$quiet" ]   && log_msg_fail  "password not generated -- aborting"
-	    return 1
-	fi
-
-	# Set in client
-
-	./samhain_setpwd samhain.build new $SHPW >/dev/null
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "./samhain_setpwd samhain.build new $SHPW";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "./samhain_setpwd samhain.build new $SHPW";
-	    return 1
-	fi
-
-	mv samhain.build.new  samhain.new || return 1
-
-	rm -f ./.samhain_log*
-	rm -f ./.samhain_lock
-
-	SHCLT=`./yule -P $SHPW`
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "yule -P $SHPW";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "yule -P $SHPW";
-	    return 1
-	fi
-
-	SHCLT1=`echo "${SHCLT}"  | sed s%HOSTNAME%${SH_LOCALHOST}%`
-	AHOST=`find_hostname`
-	SHCLT2=`echo "${SHCLT}"  | sed s%HOSTNAME%${AHOST}%`
-	
- 	echo $SHCLT1 >> testrc_2
- 	echo $SHCLT2 >> testrc_2
-
-	cp    ./testrc_2       ./rc.${SH_LOCALHOST}
-	mv    ./.samhain_file  ./file.${SH_LOCALHOST}
-	chmod 644 ./rc.${SH_LOCALHOST}
-	chmod 644 ./file.${SH_LOCALHOST}
-
-	ALTHOST=`find_hostname`
-	cp    ./testrc_2       "./rc.${ALTHOST}"
-	cp    ./file.${SH_LOCALHOST} "./file.${ALTHOST}" 2>/dev/null
-	chmod 644 ./rc.${ALTHOST}
-	chmod 644 ./file.${ALTHOST}
-
-	echo $SHPW > ./testpw
-}
-
-MAXTEST=1; export MAXTEST
-
-testrun2e ()
-{
-    log_start "RUN SERVER W/YULECTL";
-    #
-    if [ x"$1" = x ]; then
-	[ -z "$quiet" ] && log_msg_fail "Missing hostname"
-    fi
-    #
-    SH_LOCALHOST=$1; export SH_LOCALHOST
-    #
-    testrun2e_internal
-    do_test_2_e
-    if [ $? -eq 0 ]; then
-	[ -z "$quiet" ] && log_ok   1 ${MAXTEST} "Server w/yulectl";
-    else
-	[ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Server w/yulectl";
-    fi
-    ####### EXIT HERE FOR TESTING ######
-    #
-    #
-    log_end "RUN SERVER W/YULECTL"
-}
Index: trunk/test/testrun_2f.sh
===================================================================
--- trunk/test/testrun_2f.sh	(revision 591)
+++ 	(revision )
@@ -1,390 +1,0 @@
-#! /bin/sh
-
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-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 --enable-debug=gdb"; 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-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --enable-debug"; export CLIENT_BUILDOPTS
-
-do_test_2_f () {
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Server${E}: ./yule -l info -p none &"; 
-	    echo; 
-	}
-	rm -f test_log_valgrind
-
- 	# SetSocketAllowUid=$(id -u)
-	#
-	if test -f /usr/xpg4/bin/id; then
-	    MY_ID=$(/usr/xpg4/bin/id -u)
-	else
-	    MY_ID=$(id -u)
-	fi
-	#
-	sed -i -e "s/SetSocketAllowUid=0/SetSocketAllowUid=${MY_ID}/g" $RCFILE
-
-	# Start server
-	#
-	${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind &
-	PROC_Y=$!
-	five_sec_sleep
-
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Client${E}: ./samhain.new -t check --foreground --forever .. &"; 
-	    echo; 
-	}
-	${VALGRIND} ./samhain.new -t check -D -p none -l none -e info --bind-address=127.0.0.1 --server-host=localhost >/dev/null 2>>test_log_valgrind 
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "starting samhain.new";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "starting samhain.new";
-	    kill $PROC_Y
-	    return 1
-	fi
-	five_sec_sleep
-	PROC_S=$(  ps aux | grep samhain.new | grep -v grep | awk '{ print $2; }' )
-
-	for ff in 1 2; do
-	    five_sec_sleep
-	done
-	egrep "File check completed" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	NR=$( egrep "File check completed" $LOGFILE | wc -l )
-	if [ $NR -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (1)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	#
-	# >>> (1) Send SIGTTOU to force a second scan, 
-	# >>>      and verify that it was done
-	#
-	kill -TTOU $PROC_S
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Kill -TTOU";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	for ff in 1 2; do
-	    five_sec_sleep
-	done
-	NR=$( egrep "File check completed" $LOGFILE | wc -l )
-	if [ $NR -ne 2 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (2)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "sigttou";
-
-	NR=$( egrep "POLICY" $LOGFILE | wc -l )
-	if [ $NR -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (3)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	#
-	# >>> (2) Modify the file system
-	#
-
-	UUID=$(uuidgen)
-	mkdir /tmp/testrun_samhain/$UUID
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "mkdir";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	kill -TTOU $PROC_S
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Kill -TTOU (2)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	for ff in 1 2; do
-	    five_sec_sleep
-	done
-	NR=$( egrep "POLICY" $LOGFILE | wc -l )
-	if [ $NR -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (4)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "/tmp/testrun_samhain modified";
-
-	kill $PROC_S; 
-	five_sec_sleep
-
-	rm -f ./.samhain_file
-	rm -f ./file.${SH_LOCALHOST} 
-	rm -f "./file.${ALTHOST}"
-
-	rm ./.samhain_log 
-	rm -f ./.samhain_lock
-
-	#
-	# >>> (3) Re-init the database 
-	#
-	./samhain.new -t init -p none
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "init (2) ..";
-	    kill $PROC_Y;
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "init (2) ..";
-
-	#
-	# >>> (4) Re-start Samhain with delay
-	#
-
-	sed --in-place -e 's/SetUdpActive=no/StartupLoadDelay=10/g' ./rc.${SH_LOCALHOST}
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "sed (1) ..";
-	    kill $PROC_Y;
-	    return 1
-	fi
-	sed --in-place -e 's/SetUdpActive=no/StartupLoadDelay=10/g' "./rc.${ALTHOST}"
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "sed (2) ..";
-	    kill $PROC_Y;
-	    return 1
-	fi
-
-	${VALGRIND} ./samhain.new -t check -D -p none -l none -e info --bind-address=127.0.0.1 --server-host=localhost >/dev/null 2>>test_log_valgrind 
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "starting samhain.new (2)";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "starting samhain.new (2)";
-	    kill $PROC_Y
-	    return 1
-	fi
-	five_sec_sleep
-	PROC_S=$(  ps aux | grep samhain.new | grep -v grep | awk '{ print $2; }' )
-
-	#
-	# >>> (5) Copy database to server after Samhain startup
-	# >>>     verifies that StartupLoadDelay works
-	#
-
-	if test -f ./.samhain_file; then
-	    mv ./.samhain_file ./file.${SH_LOCALHOST}
-	    chmod 644 ./file.${SH_LOCALHOST}
-
-	    ALTHOST=`find_hostname`
-	    cp    ./file.${SH_LOCALHOST} "./file.${ALTHOST}" 2>/dev/null
-	    chmod 644 ./file.${ALTHOST}
-	else
-	    [ -z "$verbose" ] || log_msg_fail "baseline file ..";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	for ff in 1 2 3; do
-	    five_sec_sleep
-	done
-	NR=$( egrep "File check completed" $LOGFILE | wc -l )
-	if [ $NR -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (5)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "file check after delay";
-
-	NR=$( egrep "POLICY" $LOGFILE | wc -l )
-	if [ $NR -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (6)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	kill $PROC_S; 
-	kill $PROC_Y
-	return 0
-}
-
-testrun2f_internal ()
-{
-        [ -z "$verbose" ] || { 
-	    echo; 
-	    echo Working directory: $PW_DIR; echo MAKE is $MAKE; 
-	    echo; 
-	}
-	#
-	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building client and server${E}"; echo; }
-	#
-	if test -r "Makefile"; then
-		$MAKE distclean
-	fi
-	#
-	${TOP_SRCDIR}/configure ${CLIENT_BUILDOPTS}
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE > /dev/null 2>>test_log
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	# save binary and build server
-	#
-	cp samhain samhain.build || return 1
-	$MAKE clean >/dev/null || return 1
-
-	${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS}
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  > /dev/null 2>>test_log
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-
-	#####################################################################
-	#
-	#
-	rm -f ./.samhain_file
-	rm -f ./.samhain_log
-	rm -f ./.samhain_lock
-	rm -f ./rc.${SH_LOCALHOST}
-	rm -f ./file.${SH_LOCALHOST}
-	rm -f  "./rc.${ALTHOST}"
-	rm -f  "./file.${ALTHOST}"
-
-	cp ${SCRIPTDIR}/testrc_2.in testrc_2
-
-	sed --in-place -e 's,file = /tmp,file = /tmp/testrun_samhain,g'  testrc_2
-	mkdir /tmp/testrun_samhain 2>/dev/null
-
-	./samhain.build -t init -p none
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "init...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "init...";
-	    return 1
-	fi
-
-	# Create a password
-
-	SHPW=`./yule -G`
-	if test x"$SHPW" = x; then
-	    [ -z "$quiet" ]   && log_msg_fail  "password not generated -- aborting"
-	    return 1
-	fi
-
-	# Set in client
-
-	./samhain_setpwd samhain.build new $SHPW >/dev/null
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "./samhain_setpwd samhain.build new $SHPW";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "./samhain_setpwd samhain.build new $SHPW";
-	    return 1
-	fi
-
-	mv samhain.build.new  samhain.new || return 1
-
-	rm -f ./.samhain_log*
-	rm -f ./.samhain_lock
-
-	SHCLT=`./yule -P $SHPW`
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "yule -P $SHPW";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "yule -P $SHPW";
-	    return 1
-	fi
-
-	SHCLT1=`echo "${SHCLT}"  | sed s%HOSTNAME%${SH_LOCALHOST}%`
-	AHOST=`find_hostname`
-	SHCLT2=`echo "${SHCLT}"  | sed s%HOSTNAME%${AHOST}%`
-	
- 	echo $SHCLT1 >> testrc_2
- 	echo $SHCLT2 >> testrc_2
-
-	cp    ./testrc_2       ./rc.${SH_LOCALHOST}
-	mv    ./.samhain_file  ./file.${SH_LOCALHOST}
-	chmod 644 ./rc.${SH_LOCALHOST}
-	chmod 644 ./file.${SH_LOCALHOST}
-
-	ALTHOST=`find_hostname`
-	cp    ./testrc_2       "./rc.${ALTHOST}"
-	cp    ./file.${SH_LOCALHOST} "./file.${ALTHOST}" 2>/dev/null
-	chmod 644 ./rc.${ALTHOST}
-	chmod 644 ./file.${ALTHOST}
-
-	echo $SHPW > ./testpw
-}
-
-MAXTEST=1; export MAXTEST
-
-testrun2f ()
-{
-    log_start "RUN CLIENT/SERVER CASE ONE";
-    #
-    if [ x"$1" = x ]; then
-	[ -z "$quiet" ] && log_msg_fail "Missing hostname"
-    fi
-    #
-    SH_LOCALHOST=$1; export SH_LOCALHOST
-    #
-    testrun2f_internal
-    do_test_2_f
-    if [ $? -eq 0 ]; then
-	[ -z "$quiet" ] && log_ok   1 ${MAXTEST} "Case One Change Management Integration";
-    else
-	[ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Case One Change Management Integration";
-    fi
-    #
-    log_end "RUN CLIENT/SERVER CASE ONE"
-}
Index: trunk/test/testrun_2g.sh
===================================================================
--- trunk/test/testrun_2g.sh	(revision 591)
+++ 	(revision )
@@ -1,867 +1,0 @@
-#! /bin/sh
-
-#
-# Copyright Rainer Wichmann (2015)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-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 --enable-debug=gdb --enable-static"; 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-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --enable-static"; export CLIENT_BUILDOPTS
-
-TEST_DIRS="one two three four"
-TEST_FILES="change leave rmthis"
-BASE="/tmp/testrun_samhain"
-
-TEST_LIST="./tmp_list_file"
-
-ALTHOST=`find_hostname`
-
-PROC_S=0; export PROC_S
-PROC_Y=0; export PROC_Y
-
-mod_files ()
-{
-    rm -f "${TEST_LIST}"
-    touch "${TEST_LIST}"
-    #
-    for dd in ${TEST_DIRS}; do
-	echo "changed" > "${BASE}/$dd/change"
-	rm -f "${BASE}/$dd/rmthis"
-	echo "added" > "${BASE}/$dd/addedthis"
-	echo "${BASE}/$dd"           >> "${TEST_LIST}"
-	echo "${BASE}/$dd/change"    >> "${TEST_LIST}"
-	echo "${BASE}/$dd/rmthis"    >> "${TEST_LIST}"
-	echo "${BASE}/$dd/addedthis" >> "${TEST_LIST}"
-    done
-}
-
-do_test_2_g_yule_start () {
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Server${E}: ./yule -l info -p none &"; 
-	    echo; 
-	}
-	rm -f test_log_valgrind
-
- 	# SetSocketAllowUid=$(id -u)
-	#
-	if test -f /usr/xpg4/bin/id; then
-	    MY_ID=$(/usr/xpg4/bin/id -u)
-	else
-	    MY_ID=$(id -u)
-	fi
-	#
-	sed -i -e "s/SetSocketAllowUid=0/SetSocketAllowUid=${MY_ID}/g" $RCFILE
-
-	# Start server
-	#
-	${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind &
-	PROC_Y=$!
-	five_sec_sleep
-
-
-	[ -z "$verbose" ] || { 
-	    echo; 
-	    echo "${S}Start Client${E}: ./samhain.new -t check -D .. &"; 
-	    echo; 
-	}
-	${VALGRIND} ./samhain.new -t check -D -p none -l none -e info --bind-address=127.0.0.1 --server-host=localhost >/dev/null 2>>test_log_valgrind 
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "starting samhain.new";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "starting samhain.new";
-	    kill $PROC_Y
-	    return 1
-	fi
-	five_sec_sleep
-	PROC_S=$(  ps aux | grep samhain.new | grep -v grep | awk '{ print $2; }' | sort | head -n 1 )
-
-	for ff in 1 2; do
-	    five_sec_sleep
-	done
-	egrep "File check completed" $LOGFILE >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	NR=$( egrep "File check completed" $LOGFILE | wc -l )
-	if [ $NR -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (1)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	return 0
-}
-
-do_test_2_g_two () {
-
-	#
-	# >>> Modify files
-	#
-	mod_files
-	#
-	if ! test -f ${TEST_LIST}; then
-	    [ -z "$verbose" ] || log_msg_fail "No file list created";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	#
-	#
-	# >>> Trigger a scan
-	#
-	kill -TTOU $PROC_S
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Kill -TTOU";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	for ff in 1 2 3; do
-	    five_sec_sleep
-	done
-	NR=$( egrep "File check completed" $LOGFILE | wc -l )
-	if [ $NR -ne 2 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (2)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "sigttou";
-
-	NR=$( egrep "POLICY" $LOGFILE | grep ReadOnly | wc -l )
-	if [ $NR -ne 8 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (ReadOnly)";  
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	NR=$( egrep "POLICY" $LOGFILE | grep ADDED | wc -l )
-	if [ $NR -ne 4 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (added)";  
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	NR=$( egrep "POLICY" $LOGFILE | grep MISSING | wc -l )
-	if [ $NR -ne 4 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (removed)";  
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	kill $PROC_S; 
-	kill $PROC_Y;
-	return 0
-}
-
-do_test_2_g_one () {
-
-	#
-	# >>> (1) Modify files, create DeltaDB from file list in ${TEST_LIST}
-	#
-	mod_files
-	#
-	if ! test -f ${TEST_LIST}; then
-	    [ -z "$verbose" ] || log_msg_fail "No file list created";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	#
-	./samhain.new --outfile ./file.delta --create-database "${TEST_LIST}"
-	#
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Create DeltaDB";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	if ! test -f ./file.delta; then
-	    [ -z "$verbose" ] || log_msg_fail "No DeltaDB created";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	#
-	# >>> (2) Copy to server and tag with a UUID
-	#
-	UUID=$(uuidgen)
-	mv ./file.delta file.${SH_LOCALHOST}.${UUID}
-	if [ "x${SH_LOCALHOST}" != "x${ALTHOST}" ]
-	then
-	    cp file.${SH_LOCALHOST}.${UUID} "./file.${ALTHOST}.${UUID}"
-	fi
-	
-	#
-	# >>> (3) Tell client to load delta database.
-	# >>>     testrc_2: timestamps every 10 sec
-	#
-	grep '^SetLoopTime=10$' rc.${SH_LOCALHOST} >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "SetLoopTime != 10 in rc.${SH_LOCALHOST}";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	grep '^SetLoopTime=10$' rc.${ALTHOST} >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "SetLoopTime != 10 in rc.${ALTHOST}";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	NHOSTS=1
-	
-	./yulectl -c "DELTA:${UUID}" ${SH_LOCALHOST}
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "yulectl (1)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	if [ "x${SH_LOCALHOST}" != "x${ALTHOST}" ]
-	then
-	    ./yulectl -c "DELTA:${UUID}" ${ALTHOST}
-	    NHOSTS=2
-	    if [ $? -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "yulectl (2)";
-		kill $PROC_S; kill $PROC_Y;
-		return 1
-	    fi
-	fi
-	
-	NR=$( ./yulectl -c LIST | grep ${UUID} | grep -v grep | wc -l )
-	if [ $NR -ne $NHOSTS ]; then
-	    [ -z "$verbose" ] || log_msg_fail "yulectl (3)";
-	    [ -z "$verbose" ] || ./yulectl -c LIST
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	# Wait and verify that command has been sent
-	#
-	for tt in 1 2 3 4; do
-	    five_sec_sleep
-	done
-	#
-	NR=$( ./yulectl -c LISTALL | grep ${UUID} | grep SENT | grep -v grep | wc -l )
-	# NR=$( ./yulectl -c LIST | grep ${UUID} | grep -v grep | wc -l )
-	if [ $NR -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "yulectl (4)";
-	    [ -z "$verbose" ] || ./yulectl -c LISTALL
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	#
-	# >>> (4) Trigger a scan
-	#
-	kill -TTOU $PROC_S
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Kill -TTOU";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	for ff in 1 2; do
-	    five_sec_sleep
-	done
-	NR=$( egrep "File check completed" $LOGFILE | wc -l )
-	if [ $NR -ne 2 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (2)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "sigttou";
-
-	NR=$( egrep "POLICY" $LOGFILE | wc -l )
-	if [ $NR -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (3)";  
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	# --- The End ---
-
-	kill $PROC_S; 
-	kill $PROC_Y
-	return 0
-}
-
-do_test_2_g_three () {
-
-	#
-	# >>> (1) Modify files, create DeltaDB from file list in ${TEST_LIST}
-	#
-	mod_files
-	#
-	if ! test -f ${TEST_LIST}; then
-	    [ -z "$verbose" ] || log_msg_fail "No file list created";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	#
-	./samhain.new --outfile ./file.delta --create-database "${TEST_LIST}"
-	#
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Create DeltaDB";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	if ! test -f ./file.delta; then
-	    [ -z "$verbose" ] || log_msg_fail "No DeltaDB created";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "... DeltaDB created ...";
-	
-	#
-	# >>> (2) Copy to server and tag with a UUID
-	#
-	UUID=$(uuidgen)
-	if [ x"$1" != "xnosig" ]; then
-	    scripts/samhainadmin.pl -k 8A0B337A -m E ./file.delta >/dev/null
-	fi
-	if [ x"$1" == "xnodelta" ]; then
-	    rm -f ./file.*
-	else
-	    mv ./file.delta file.${SH_LOCALHOST}.${UUID}
-	    if [ "x${SH_LOCALHOST}" != "x${ALTHOST}" ]
-	    then
-		cp file.${SH_LOCALHOST}.${UUID} "./file.${ALTHOST}.${UUID}"
-	    fi
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "... DeltaDB copied as file.${SH_LOCALHOST}.${UUID} ...";
-	
-	#
-	# >>> (3) Tell client to load delta database.
-	# >>>     testrc_2: timestamps every 10 sec
-	#
-	grep '^SetLoopTime=10$' rc.${SH_LOCALHOST} >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "SetLoopTime != 10 in rc.${SH_LOCALHOST}";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	grep '^SetLoopTime=10$' rc.${ALTHOST} >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "SetLoopTime != 10 in rc.${ALTHOST}";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	NHOSTS=1
-	
-	./yulectl -c "DELTA:${UUID}" ${SH_LOCALHOST}
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "yulectl (1)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	
-	if [ "x${SH_LOCALHOST}" != "x${ALTHOST}" ]
-	then
-	    ./yulectl -c "DELTA:${UUID}" ${ALTHOST}
-	    NHOSTS=2
-	    if [ $? -ne 0 ]; then
-		[ -z "$verbose" ] || log_msg_fail "yulectl (2)";
-		kill $PROC_S; kill $PROC_Y;
-		return 1
-	    fi
-	fi
-	
-	NR=$( ./yulectl -c LIST | grep ${UUID} | grep -v grep | wc -l )
-	if [ $NR -ne $NHOSTS ]; then
-	    [ -z "$verbose" ] || log_msg_fail "yulectl (3)";
-	    [ -z "$verbose" ] || ./yulectl -c LIST
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "... command sent to client ...";
-
-	# Wait and verify that command has been sent
-	#
-	for tt in 1 2 3 4; do
-	    five_sec_sleep
-	done
-	#
-	NR=$( ./yulectl -c LISTALL | grep ${UUID} | grep SENT | grep -v grep | wc -l )
-	if [ $NR -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "yulectl (4): ${UUID}";
-	    [ -z "$verbose" ] || ./yulectl -c LISTALL
-	    [ -z "$verbose" ] || echo "(now just LIST)"
-	    [ -z "$verbose" ] || ./yulectl -c LIST
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	[ -z "$verbose" ] || OLINE=$( ./yulectl -c LISTALL | grep ${UUID} )
-	[ -z "$verbose" ] || echo "${OLINE}"
-
-	#
-	# >>> (4) Trigger a scan
-	#
-	kill -TTOU $PROC_S
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Kill -TTOU";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	[ -z "$verbose" ] || echo    " ... TTOU sent to /${PROC_S}/ ...";
-	
-	for ff in 1 2; do
-	    five_sec_sleep
-	done
-	if [ x"$1" != x ]; then
-	    if [ x"$1" = xnodelta ]; then
-		NR=$( egrep "File download failed" $LOGFILE | wc -l )
-	    else
-		NR=$( egrep "No good signature" $LOGFILE | wc -l )
-	    fi
-	    if [ $NR -ne 1 ]; then
-		[ -z "$verbose" ] || log_msg_fail "Client file check (expected fail)";
-		kill $PROC_S; kill $PROC_Y;
-		return 1
-	    else
-		[ -z "$verbose" ] || log_msg_ok "Client file check (expected fail)";
-		kill $PROC_S; kill $PROC_Y;
-		return 0
-	    fi
-	fi
-
-	NR=$( egrep "File check completed" $LOGFILE | wc -l )
-	if [ $NR -ne 2 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (2)";
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-	[ -z "$verbose" ] || log_msg_ok    "sigttou";
-
-	NR=$( egrep "POLICY" $LOGFILE | wc -l )
-	if [ $NR -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "Client file check (3)";  
-	    kill $PROC_S; kill $PROC_Y;
-	    return 1
-	fi
-
-	# --- The End ---
-
-	kill $PROC_S; 
-	kill $PROC_Y
-	return 0
-}
-
-testrun2g_prepare ()
-{
-	#####################################################################
-	#
-	# Create test area and initialize database
-	#
-	rm -f ./.samhain_file
-	rm -f ./.samhain_log
-	rm -f ./.samhain_lock
-	rm -f ./rc.${SH_LOCALHOST}
-	rm -f ./rc.${ALTHOST}
-	rm -f ./file.*
-	#
-	rm -rf ${BASE}
-	#
-	mkdir ${BASE} 2>/dev/null
-	for dd in ${TEST_DIRS}; do
-	    mkdir ${BASE}/$dd
-	    for ff in ${TEST_FILES}; do
-		echo "foobar" > ${BASE}/$dd/$ff
-	    done
-	done
-	#
-	./samhain.build -t init -p none
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "init...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "init...";
-	    return 1
-	fi
-}
-
-testrun2g_build ()
-{
-        [ -z "$verbose" ] || { 
-	    echo; 
-	    echo Working directory: $PW_DIR; echo MAKE is $MAKE; 
-	    echo; 
-	}
-	#
-	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building client and server${E}"; echo; }
-	#
-	if test -r "Makefile"; then
-		$MAKE distclean
-	fi
-	#
-	${TOP_SRCDIR}/configure ${CLIENT_BUILDOPTS} $1 $2 >/dev/null 2>&1
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE > /dev/null 2>>test_log
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	# save binary and build server
-	#
-	cp samhain samhain.build || return 1
-	if test -f scripts/samhainadmin.pl
-	then
-	    cp scripts/samhainadmin.pl  scripts/xxx_samhainadmin.pl
-	fi
-	$MAKE clean >/dev/null || return 1
-
-	${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS}
-	#
-	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  > /dev/null 2>>test_log
-		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
-		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
-		fi
-
-	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
-	fi
-
-	# Create a password
-
-	SHPW=`./yule -G`
-	if test x"$SHPW" = x; then
-	    [ -z "$quiet" ]   && log_msg_fail  "password not generated -- aborting"
-	    return 1
-	fi
-
-	# Set in client
-
-	./samhain_setpwd samhain.build new $SHPW >/dev/null
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "./samhain_setpwd samhain.build new $SHPW";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "./samhain_setpwd samhain.build new $SHPW";
-	    return 1
-	fi
-
-	mv samhain.build.new  samhain.new || return 1
-	if test -f scripts/xxx_samhainadmin.pl
-	then
-	    cp scripts/xxx_samhainadmin.pl  scripts/samhainadmin.pl
-	fi
-
-	rm -f ./.samhain_log*
-	rm -f ./.samhain_lock
-
-	SHCLT=`./yule -P $SHPW`
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "yule -P $SHPW";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "yule -P $SHPW";
-	    return 1
-	fi
-
-	SHCLT1=`echo "${SHCLT}"  | sed s%HOSTNAME%${SH_LOCALHOST}%`
-	AHOST=`find_hostname`
-	SHCLT2=`echo "${SHCLT}"  | sed s%HOSTNAME%${AHOST}%`
-	
-	cp ${SCRIPTDIR}/testrc_2.in testrc_2
-	#
-	sed --in-place -e 's,file = /tmp,dir = 99/tmp/testrun_samhain,g' testrc_2
-	# 
-	sed --in-place -e 's,SetUdpActive=no,ReportCheckflags=yes,g' testrc_2
-	#
- 	echo $SHCLT1 >> testrc_2
- 	echo $SHCLT2 >> testrc_2
-
-	echo $SHPW > ./testpw
-}
-
-testrun2g_signrc ()
-{
-    scripts/samhainadmin.pl  -m R $1 >/dev/null
-    scripts/samhainadmin.pl  -k 8A0B337A -m E $1 >/dev/null
-}
-
-testrun2g_signdb ()
-{
-    scripts/samhainadmin.pl  -k 8A0B337A -m E ./.samhain_file >/dev/null
-}
-
-copy_rc_db_files ()
-{
-	cp    ./testrc_2       ./rc.${SH_LOCALHOST}
-	mv    ./.samhain_file  ./file.${SH_LOCALHOST}
-	if [ $? -ne 0 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "No .samhain_file";
-	    return 1
-	fi
-	chmod 644 ./rc.${SH_LOCALHOST}
-	chmod 644 ./file.${SH_LOCALHOST}
-
-	if [ "x${SH_LOCALHOST}" != "x${ALTHOST}" ]
-	then
-	    cp    ./testrc_2       "./rc.${ALTHOST}"
-	    cp    ./file.${SH_LOCALHOST} "./file.${ALTHOST}" 2>/dev/null
-	    chmod 644 ./rc.${ALTHOST}
-	    chmod 644 ./file.${ALTHOST}
-	fi
-}
-
-MAXTEST=6; export MAXTEST
-
-testrun2g ()
-{
-    log_start "RUN CLIENT/SERVER CASE TWO";
-    #
-    if [ x"$1" = x ]; then
-	[ -z "$quiet" ] && log_msg_fail "Missing hostname"
-    fi
-    #
-    SH_LOCALHOST=$1; export SH_LOCALHOST
-    #
-
-
-    # Test with missing delta
-    #
-    gpg --list-keys | grep 8A0B337A >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	echo "You need to do 'gpg --import test/gnupg/public-key.asc' first"
-	log_skip 1 $MAXTEST 'Case Two w/signed files'
-    else
-	testrun2g_build "--with-gpg=/usr/bin/gpg" "--with-keyid=0x8A0B337A"
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "build..";
-	    testrun2g_signrc ./testrc_2
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "sign rc..";
-	    testrun2g_prepare
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "prepare..";
-	    testrun2g_signdb
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "sign db..";
-	    copy_rc_db_files
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "copy..";
-	    do_test_2_g_yule_start
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "start yule..";
-	    do_test_2_g_three nodelta
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$quiet" ] && log_ok   1 ${MAXTEST} "Case Two w/missing delta";
-	else
-	    [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Case Two w/missing delta";
-	fi
-    fi
-
-    # Test with unsigned delta
-    #
-    gpg --list-keys | grep 8A0B337A >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	echo "You need to do 'gpg --import test/gnupg/public-key.asc' first"
-	log_skip 1 $MAXTEST 'Case Two w/signed files'
-    else
-	testrun2g_build "--with-gpg=/usr/bin/gpg" "--with-keyid=0x8A0B337A"
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "build..";
-	    testrun2g_signrc ./testrc_2
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "sign rc..";
-	    testrun2g_prepare
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "prepare..";
-	    testrun2g_signdb
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "sign db..";
-	    copy_rc_db_files
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "copy..";
-	    do_test_2_g_yule_start
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "start yule..";
-	    do_test_2_g_three nosig
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$quiet" ] && log_ok   1 ${MAXTEST} "Case Two w/unsigned delta";
-	else
-	    [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Case Two w/unsigned delta";
-	fi
-    fi
-
-    # Test with signed files, no sig client
-    #
-    gpg --list-keys | grep 8A0B337A >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	echo "You need to do 'gpg --import test/gnupg/public-key.asc' first"
-	log_skip 1 $MAXTEST 'Case Two w/signed files'
-    else
-	testrun2g_build
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "build..";
-	    testrun2g_signrc ./testrc_2
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "sign rc..";
-	    testrun2g_prepare
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "prepare..";
-	    testrun2g_signdb
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "sign db..";
-	    copy_rc_db_files
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "copy..";
-	    do_test_2_g_yule_start
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "start yule..";
-	    do_test_2_g_three
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$quiet" ] && log_ok   1 ${MAXTEST} "Case Two w/signed files+nosig client";
-	else
-	    [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Case Two w/signed files+nosig client";
-	fi
-    fi
-
-    # Test with signed files
-    #
-    gpg --list-keys | grep 8A0B337A >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	echo "You need to do 'gpg --import test/gnupg/public-key.asc' first"
-	log_skip 1 $MAXTEST 'Case Two w/signed files'
-    else
-	testrun2g_build "--with-gpg=/usr/bin/gpg" "--with-keyid=0x8A0B337A"
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "build..";
-	    testrun2g_signrc ./testrc_2
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "sign rc..";
-	    testrun2g_prepare
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "prepare..";
-	    testrun2g_signdb
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "sign db..";
-	    copy_rc_db_files
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "copy..";
-	    do_test_2_g_yule_start
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$verbose" ] || log_msg_ok    "start yule..";
-	    do_test_2_g_three
-	fi
-	if [ $? -eq 0 ]; then
-	    [ -z "$quiet" ] && log_ok   1 ${MAXTEST} "Case Two w/signed files";
-	else
-	    [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Case Two w/signed files";
-	fi
-    fi
-
-    # Test with non-signed files
-    #
-    testrun2g_build
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_ok    "build..";
-	testrun2g_prepare
-    fi
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_ok    "prepare..";
-	copy_rc_db_files
-    fi
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_ok    "copy..";
-	do_test_2_g_yule_start
-    fi
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_ok    "start yule..";
-	do_test_2_g_one
-    fi
-    if [ $? -eq 0 ]; then
-	[ -z "$quiet" ] && log_ok   2 ${MAXTEST} "Case Two w/unsigned files";
-    else
-	[ -z "$quiet" ] && log_fail 2 ${MAXTEST} "Case Two w/unsigned files";
-    fi
-
-
-
-    #
-    testrun2g_prepare
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_ok    "prepare..";
-	copy_rc_db_files
-    fi
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_ok    "copy..";
-	do_test_2_g_yule_start
-    fi
-    if [ $? -eq 0 ]; then
-	[ -z "$verbose" ] || log_msg_ok    "start yule..";
-	do_test_2_g_two
-    fi
-    if [ $? -eq 0 ]; then
-	[ -z "$quiet" ] && log_ok   3 ${MAXTEST} "Case Two w/o delta";
-    else
-	[ -z "$quiet" ] && log_fail 3 ${MAXTEST} "Case Two w/o delta";
-    fi
-
-    if test -f scripts/xxx_samhainadmin.pl
-    then
-	rm -f scripts/xxx_samhainadmin.pl
-    fi
-
-
-    log_end "RUN CLIENT/SERVER CASE TWO"
-}
Index: trunk/test/testrun_2h.sh
===================================================================
--- trunk/test/testrun_2h.sh	(revision 591)
+++ 	(revision )
@@ -1,233 +1,0 @@
-#! /bin/sh
-
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-RCFILE="$PW_DIR/testrc_2";  export RCFILE
-RCFILE_C="$PW_DIR/testrc_1.dyn";  export RCFILE_C
-
-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-micro-stealth=137 --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_C} --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
-
-testrun2h_internal ()
-{
-    SIGNIFY="$1"
-
-    [ -z "$verbose" ] || { 
-	echo; 
-	echo Working directory: $PW_DIR; echo MAKE is $MAKE; echo SIGNIFY is $SIGNIFY;
-	echo; 
-    }
-
-    [ -z "$verbose" ] || { echo; echo "${S}Building client and server${E}"; echo; }
-
-    if test -r "Makefile"; then
-	$MAKE distclean
-    fi
-
-    #
-    # Bootstrapping
-    #
-    ${TOP_SRCDIR}/configure >/dev/null 2>/dev/null
-    if test x$? = x0; then
-	[ -z "$verbose" ] ||     log_msg_ok "configure (bootstrap)..."; 
-	$MAKE  > /dev/null 2>&1
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok "make (bootstrap)..."; 
-	else
-	    [ -z "$quiet" ] &&   log_msg_fail "make (bootstrap)..."; 
-	    return 1
-	fi
-	
-    else
-	[ -z "$quiet" ] &&       log_msg_fail "configure (bootstrap)...";
-	return 1
-    fi
-
-    ${TOP_SRCDIR}/configure --with-signify=${SIGNIFY} --with-checksum=yes ${CLIENT_BUILDOPTS} >/dev/null 2>&1
-
-    if test x$? = x0; then
-	[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-	$MAKE  > /dev/null 2>>test_log
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok "make..."; 
-	else
-	    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-	    return 1
-	fi
-    else
-	[ -z "$quiet" ] &&       log_msg_fail "configure...";
-	return 1
-    fi
-
-    cp ${SCRIPTDIR}/testrc_1i.dyn "$RCFILE_C"
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "copy signify signed config file...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "copy signify signed config file...";
-	return 1
-    fi
-
-    # save binary and build server
-
-    cp samhain samhain.build || return 1
-    $MAKE clean >/dev/null || return 1
-    
-    ${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS}
-
-    if test x$? = x0; then
-	[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-	$MAKE  > /dev/null 2>>test_log
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok "make..."; 
-	else
-	    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-	    return 1
-	fi
-	
-    else
-	[ -z "$quiet" ] &&       log_msg_fail "configure...";
-	return 1
-    fi
-    
-    
-    #####################################################################
-    #
-    #
-    rm -f ./.samhain_file
-    rm -f ./.samhain_log
-    rm -f ./.samhain_lock
-    rm -f ./rc.${SH_LOCALHOST}
-    rm -f ./file.${SH_LOCALHOST}
-    
-    cp ${SCRIPTDIR}/testrc_2.in testrc_2
-    
-    ./samhain.build -t init -p none
-    
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "init...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "init...";
-	return 1
-    fi
-    
-    cp ${SCRIPTDIR}/test1i_file.sig $PW_DIR/.samhain_file
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "copy signed database file...";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "copy signed database file...";
-	return 1
-    fi
-
-    # Create a password
-
-    SHPW=`./yule -G`
-    if test x"$SHPW" = x; then
-	[ -z "$quiet" ]   && log_msg_fail  "password not generated -- aborting"
-	return 1
-    fi
-    
-    # Set in client
-    
-    ./samhain_setpwd samhain.build new $SHPW >/dev/null
-    
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "./samhain_setpwd samhain.build new $SHPW";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "./samhain_setpwd samhain.build new $SHPW";
-	return 1
-    fi
-    
-    mv samhain.build.new  samhain.new || return 1
-    
-    rm -f ./.samhain_log*
-    rm -f ./.samhain_lock
-    
-    SHCLT=`./yule -P $SHPW`
-    
-    if test x$? = x0; then
-	[ -z "$verbose" ] || log_msg_ok    "yule -P $SHPW";
-    else
-	[ -z "$quiet" ]   && log_msg_fail  "yule -P $SHPW";
-	return 1
-    fi
-    
-    SHCLT1=`echo "${SHCLT}"  | sed s%HOSTNAME%${SH_LOCALHOST}%`
-    AHOST=`find_hostname`
-    SHCLT2=`echo "${SHCLT}"  | sed s%HOSTNAME%${AHOST}%`
-	
-
-    echo $SHCLT1 >> testrc_2
-    echo $SHCLT2 >> testrc_2
-
-    
-    cp    "${RCFILE_C}"              ./rc.${SH_LOCALHOST}
-    mv    $PW_DIR/.samhain_file      ./file.${SH_LOCALHOST}
-
-    ALTHOST=`find_hostname`
-    cp    "${RCFILE_C}"          "./rc.${ALTHOST}"
-    cp    ./file.${SH_LOCALHOST} "./file.${ALTHOST}" 2>/dev/null
-}
-
-MAXTEST=1; export MAXTEST
-
-testrun2h ()
-{
-    log_start "RUN FULL CLIENT/SERVER W/SIGNIFY";
-    #
-    if [ x"$1" = x ]; then
-	[ -z "$quiet" ] && log_msg_fail "Missing hostname"
-    fi
-    #
-    SIGNIFY=`find_path signify-openbsd`
-    if [ -z "$SIGNIFY" ]; then
-	SIGNIFY=`find_path signify`
-    fi
-    if [ -z "$SIGNIFY" ]; then
-	log_skip 1 $MAXTEST 'signify not found in $PATH'
-    fi
-	    
-    SH_LOCALHOST=$1; export SH_LOCALHOST
-    
-    testrun2h_internal "${SIGNIFY}"
-
-    SAVE_VALGRIND="${VALGRIND}"; VALGRIND=''; export VALGRIND
-    do_test_1_a
-    out=$?
-    VALGRIND="${SAVE_VALGRIND}"; export VALGRIND 
-
-    if [ $out -eq 0 ]; then
-    	[ -z "$quiet" ] && log_ok   1 ${MAXTEST} "Client download+logging w/signify";
-    else
-    	[ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client download+logging w/signify";
-    fi
-    
-    if [ -n "$cleanup" ]; then
-    	rm -f ./rc.${SH_LOCALHOST}
-    	rm -f ./file.${SH_LOCALHOST}
-    	ALTHOST=`find_hostname`
-    	rm -f "./file.${ALTHOST}"
-    	rm -f "./rc.${ALTHOST}"
-    fi
-
-    log_end "RUN FULL CLIENT/SERVER W/SIGNIFY"
-}
-
Index: trunk/test/testtimesrv.sh
===================================================================
--- trunk/test/testtimesrv.sh	(revision 591)
+++ trunk/test/testtimesrv.sh	(revision 1)
@@ -1,424 +1,103 @@
 #! /bin/sh
 
-#
-# Copyright Rainer Wichmann (2006)
-#
-# License Information:
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
 
-RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
-LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
-PIDFILE="$PW_DIR/.samhain_lock"; export PIDFILE
+# The following two are the ANSI sequences for start and end embolden
+case $TERM in
+vt*|ansi*|con*|xterm*|linux*|screen*)
+  S=[1m
+  E=[m
+  ;;
+*)
+  S=
+  E=
+  ;;
+esac
 
-BASE="${PW_DIR}/testrun_testdata"; export BASE
-TDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c"; export TDIRS
-TFILES="x y z"; export TFILES
+PW_DIR=`pwd`
 
-prep_testdata ()
-{
-    if test -d "$BASE"; then
-	chmod -f -R 0700 "${BASE}" || {
-	    [ -z "$quiet" ] &&   log_msg_fail "chmod -f -R 0700 ${BASE}"; 
-	    return 1;
-	}
+if test x$UID != x; then
+  TRUST="--with-trusted=0,2,$UID"
+else
+  TRUST="--with-trusted=0,2"
+fi
+
+echo; echo "${S}__ STARTING TEST TIMESERVER OPTION __${E}"; echo;
+echo Working directory: $PW_DIR
+
+MAKE=`which gmake`
+if test "x$?" = x1 ; then
+    MAKE="make -s"
+else
+    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
+    if test "x$MAKE" = x; then
+	MAKE="make -s"
+    elif test "x$MAKE" = xno; then
+	MAKE="make -s"
+    else
+	if test "x$MAKE" = "xwhich:"; then
+		MAKE="make -s"
+	else
+		MAKE="gmake -s"
+		gmake -v >/dev/null 2>&1 || MAKE="make -s"
+	fi
     fi
+fi
 
-    rm -rf "${BASE}" || {
-	[ -z "$quiet" ] &&   log_msg_fail "rm -rf ${BASE}"; 
-	return 1;
-    }
-
-    mkdir "${BASE}" || {
-	[ -z "$quiet" ] &&   log_msg_fail "mkdir ${BASE}"; 
-	return 1;
-    }
-
-    for ff in $TDIRS; do
-	mkdir "${BASE}/${ff}" || { 
-	    [ -z "$quiet" ] &&   log_msg_fail "mkdir ${BASE}/${ff}"; 
-	    return 1;
-	}
-	chmod 0755 "${BASE}/${ff}"
-	for gg in $TFILES; do
-	    echo "This is a test file" > "${BASE}/${ff}/${gg}"
-	    chmod 0644 "${BASE}/${ff}/${gg}"
-	done
-    done
-}
-
-mkconfig_misc ()
-{
-    test -f "${RCFILE}" || touch "${RCFILE}"
-    cat >> "${RCFILE}" <<End-of-data
-[Misc]
-Daemon=no
-SetFilecheckTime=60
-TrustedUser=uucp,fax,fnet
-SetRecursionLevel=10
-SetLoopTime=30
-ReportFullDetail = no
-ChecksumTest=check
-
-End-of-data
-}
-
-mkconfig_log ()
-{
-    test -f "${RCFILE}" || touch "${RCFILE}"
-    cat >> "${RCFILE}" <<End-of-data
-[Log]
-MailSeverity=none
-LogSeverity=warn
-SyslogSeverity=none
-PrintSeverity=info
-MailSeverity=none
-#Restrict to certain classes of messages
-#LogClass=RUN
-#PreludeSeverity=err
-#ExportSeverity=none
-
-End-of-data
-}
-
-mkconfig_sev ()
-{
-    test -f "${RCFILE}" || touch "${RCFILE}"
-    cat >> "${RCFILE}" <<End-of-data
-[EventSeverity]
-SeverityUser0=crit
-SeverityUser1=crit
-SeverityReadOnly=crit
-SeverityLogFiles=crit
-SeverityGrowingLogs=crit
-SeverityIgnoreNone=crit
-SeverityAttributes=crit
-SeverityIgnoreAll=crit
-SeverityFiles=err
-SeverityDirs=err
-SeverityNames=warn
-
-End-of-data
-}
-
-prep_init ()
-{
-    rm -f ./.samhain_file
-    rm -f "${LOGFILE}"
-    rm -f ./.samhain_lock
-
-    rm -f "${RCFILE}"
-    mkconfig_sev
-    mkconfig_log
-    mkconfig_misc
-}
-
-TESTPOLICY="
-[ReadOnly]
-dir=${BASE}/c
-[Attributes]
-dir=${BASE}/a
-#dir=${BASE}/b
-"
+echo MAKE is $MAKE
+echo
 
 
-testtime0_int ()
+testtime0 ()
 {
-	[ -z "$verbose" ] || echo Working directory: $PW_DIR
-	[ -z "$verbose" ] || { echo MAKE is $MAKE; echo; }
 	#
 	# standalone compilation
 	#
-	[ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
+	echo "${S}Building standalone agent w/timeserver${E}"; echo;
 	#
 	if test -r "Makefile"; then
-		$MAKE distclean >/dev/null
+		$MAKE distclean
 	fi
 	#
-	${TOP_SRCDIR}/configure --quiet --enable-debug --enable-xml-log --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE --with-log-file=$LOGFILE --with-pid-file=$PIDFILE --with-data-file=$PW_DIR/.samhain_file
+	${TOP_SRCDIR}/configure --quiet --enable-debug --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/test/testrc_1  --with-timeserver=www.foo.bar --with-alttimeserver=127.0.0.1 --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file
 	#
 	if test x$? = x0; then
-		[ -z "$verbose" ] ||     log_msg_ok "configure..."; 
-		$MAKE  > /dev/null 2>>test_log
+		echo "configure completed, exit status 0"; echo;
+		$MAKE  > /dev/null
+		echo "$MAKE completed, exit status $?"; echo;
+	else
+		echo "ERROR: configure failed"; echo;
+	fi
+
+
+	rm -f $PW_DIR/.samhain_file $PW_DIR/.samhain_log $PW_DIR/.samhain_lock
+
+	./samhain -t init
+	
+	if test x$? = x0; then
+		echo
+		echo "${S}init completed${E}"
+		echo
+		./samhain -t check
 		if test x$? = x0; then
-		    [ -z "$verbose" ] || log_msg_ok "make..."; 
+		    echo "${S}check completed${E}"
 		else
-		    [ -z "$quiet" ] &&   log_msg_fail "make..."; 
-		    return 1
+		    echo "${S}ERROR:${E} -- check -- failed, exit status $?"
+		    echo
+		    exit
 		fi
 	else
-		[ -z "$quiet" ] &&       log_msg_fail "configure...";
-		return 1
+		echo "${S}ERROR:${E} -- init -- failed, exit status $?"; echo;
+		exit
 	fi
 
-	prep_init && prep_testdata && echo "$TESTPOLICY" >>$RCFILE
-	if [ $? -ne 0 ]; then
-	    [ -z "$quiet" ]   && log_msg_fail  "prepare...";
-	    return 1
-	fi
-
-	./samhain -t init -p none
-	
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "init...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "init...";
-	    return 1
-	fi
-
-	chmod 0555 "${BASE}/a/x"
-	chmod 0555 "${BASE}/b/x"
-
-	./samhain -t check -p none -l info -D
-
-	count=0
-	until [ -f $PIDFILE ]; do
-	    one_sec_sleep
-	    let "count = count + 1" >/dev/null
-	    if [ $count -gt 12 ]; then
-		break;
-	    fi
-	done
-
-	if test x$? = x0; then
-	    [ -z "$verbose" ] || log_msg_ok    "start daemon...";
-	else
-	    [ -z "$quiet" ]   && log_msg_fail  "start daemon...";
-	    return 1
-	fi
-
-	return 0
-}
-
-MAXTEST=14; export MAXTEST
-
-die () {
-    test -z "$stoponerr" && return 0;
-    PID=`cat $PIDFILE`
-    kill -9 $PID
-}
-
-killdaemon () {
-    if [ -f $PIDFILE ]; then
-	PID=`cat $PIDFILE`
-	kill -9 $PID
-    fi
-}
-
-check_err () {
-    if [ ${2} -ne 0 ]; then
-	die;
-	[ -z "$quiet" ] && log_fail ${1} ${MAXTEST} "${3}";
-	return 1
-    else
-	[ -z "$quiet" ] && log_ok   ${1} ${MAXTEST} "${3}";
-    fi
-}
-
-daemontest_started () {
-    PID=`cat $PIDFILE`
-
-    kill -0 $PID
-    check_err ${1} $? "started"
-}
-
-daemontest_sigterm () {
-    PID=`cat $PIDFILE`
-
-    kill -15 $PID
-    count=0
-    while [ `kill -0 $PID` ]; do
-	one_sec_sleep
-	let "count = count + 1" >/dev/null
-	if [ $count -gt 12 ]; then
-	    check_err ${1} 1 "sigterm"
-	    return 1
-	fi
-    done
-    check_err ${1} 0 "sigterm"
-}
-
-daemontest_sigusr2 () {
-    PID=`cat $PIDFILE`
-
-    tmp=`grep 'File check completed' $LOGFILE | wc -l`
-    kill -USR2 $PID
-    kill -TTOU $PID
-    
-    count=0
-    tmp2=`grep 'SUSPEND' $LOGFILE | wc -l`
-    while [ $tmp2 -ne $2 ]; do
-	one_sec_sleep
-	let "count = count + 1" >/dev/null
-	if [ $count -gt 12 ]; then
-	    check_err ${1} 1 "sigusr2: suspend"
-	    return 1
-	fi
-	tmp2=`grep 'SUSPEND' $LOGFILE | wc -l`
-    done
-
-    kill -USR2 $PID
-
-    count=0
-    tmp2=$tmp
-    while [ $tmp2 -eq $tmp ]; do
-	one_sec_sleep
-	let "count = count + 1" >/dev/null
-	if [ $count -gt 12 ]; then
-	    check_err ${1} 1 "sigusr2: wakeup"
-	    return 1
-	fi
-	tmp2=`grep 'File check completed' $LOGFILE | wc -l`
-    done
-    check_err ${1} 0 "sigusr2"
-}
-
-daemontest_sigttou () {
-    PID=`cat $PIDFILE`
-
-    tmp=`grep 'File check completed' $LOGFILE | wc -l`
-    kill -TTOU $PID
-    count=0
-    tmp2=$tmp
-    while [ $tmp2 -eq $tmp ]; do
-	one_sec_sleep
-	let "count = count + 1" >/dev/null
-	if [ $count -gt 12 ]; then
-	    check_err ${1} 1 "sigttou"
-	    return 1
-	fi
-	tmp2=`grep 'File check completed' $LOGFILE | wc -l`
-    done
-    check_err ${1} 0 "sigttou"
-}
-
-daemontest_sighup () {
-
-    if [ $2 -eq 1 ]; then
-	echo "dir=${BASE}/b" >>$RCFILE
-	tmp=`grep CRIT $LOGFILE | grep -v Runtime | wc -l`
-	if [ $tmp -ne 1 ]; then
-	    [ -z "$verbose" ] || log_msg_fail "policy count (before)";
-	    return 1
-	fi
-    fi
-    
-    PID=`cat $PIDFILE`
-    kill -HUP $PID
-
-    if [ $2 -eq 1 ]; then
-	kill -TTOU $PID
-	count=0
-	tmp=`grep CRIT $LOGFILE | grep -v Runtime | wc -l`
-	while [ $tmp -lt 2 ]; do
-	    one_sec_sleep
-	    let "count = count + 1" >/dev/null
-	    if [ $count -gt 12 ]; then
-		[ -z "$verbose" ] || log_msg_fail "policy count (after)";
-		return 1
-	    fi
-	    tmp=`grep CRIT $LOGFILE | grep -v Runtime | wc -l`
-	done
-    fi    
-
-    count=0
-    tmp2=0
-    while [ $tmp2 -ne $2 ]; do
-	one_sec_sleep
-	let "count = count + 1" >/dev/null
-	if [ $count -gt 12 ]; then
-	    check_err ${1} 1 "sighup"
-	    return 1
-	fi
-	tmp2=`grep 'Runtime configuration reloaded' $LOGFILE | wc -l`
-    done
-    check_err ${1} 0 "sighup"
-}
-
-daemontest_sigabrt () {
-    PID=`cat $PIDFILE`
-    kill -${3} $PID
-
-    count=0
-    while [ -f $LOGFILE.lock ]; do
-	one_sec_sleep
-	let "count = count + 1" >/dev/null
-	if [ $count -gt 12 ]; then
-	    check_err ${1} 1 "sigabrt"
-	    return 1
-	fi
-    done
-
-    kill -TTOU $PID
-
-    five_sec_sleep
-
-    if [ -f $LOGFILE.lock ]; then
-	tmp=`grep '<trail>' $LOGFILE | wc -l`
-	tst=$2; let "tst = tst + 2" >/dev/null;
-	if [ $tmp -eq $tst ]; then
-	    check_err ${1} 0 "sigabrt"
-	    return 0
-	fi
-    fi
-    check_err ${1} 1 "sigabrt"
-}
-
-testtime0 () {
-    log_start "DAEMON CONTROL"
-
-    testtime0_int;
-
-    tcount=1
-
-    trap 'killdaemon' 1 3 15
-
-    daemontest_started $tcount;
-
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sigttou $tcount;
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sigttou $tcount;
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sigttou $tcount;
-
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sigusr2 $tcount 1;
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sigusr2 $tcount 2;
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sigusr2 $tcount 3;
-
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sigabrt $tcount 1 ABRT;
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sigabrt $tcount 2 TTIN;
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sigabrt $tcount 3 ABRT;
-
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sighup  $tcount 1;
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sighup  $tcount 2;
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sighup  $tcount 3;
-
-    let "tcount = tcount + 1" >/dev/null
-    daemontest_sigterm $tcount;
-
-    log_end "DAEMON CONTROL"
 }
 
 
+
+	testtime0
+
+
+echo; echo "${S}__ END TEST TIMESERVER OPTION __${E}"; echo;
+
+exit
+
