Index: trunk/test/testrun_1e.sh
===================================================================
--- trunk/test/testrun_1e.sh	(revision 179)
+++ trunk/test/testrun_1e.sh	(revision 206)
@@ -23,5 +23,42 @@
 export BUILDOPTS
 
-MAXTEST=4; export MAXTEST
+MAXTEST=5; export MAXTEST
+
+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="
@@ -147,4 +184,24 @@
     eval echo '"$'"PORTPOLICY_$1"'"' >>"${RCFILE}"
 }
+
+run_check_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 ()
@@ -209,8 +266,81 @@
 	  rm -f "$LOGFILE"
 	  #
-	  if [ $errval -eq 0 ]; then
-	      run_check
-	      check_err $? ${tcount}; errval=$?
-	  fi
+	  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}
@@ -219,8 +349,16 @@
 	  #
 	  if [ $errval -eq 0 ]; then
-	      [ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST};
+	      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
 	    
