Index: trunk/docs/Changelog
===================================================================
--- trunk/docs/Changelog	(revision 51)
+++ trunk/docs/Changelog	(revision 52)
@@ -1,2 +1,6 @@
+2.2.3:
+	* fix stealth mode (regression in parser), problem reported by 
+	  Joschi Kuphal
+
 2.2.2 (17-07-2006)
 	* minor fixes for regression test scripts
Index: trunk/src/samhain.c
===================================================================
--- trunk/src/samhain.c	(revision 51)
+++ trunk/src/samhain.c	(revision 52)
@@ -1449,8 +1449,5 @@
 
 #if (defined(WITH_GPG) || defined(WITH_PGP))
-  /* do nothing -- we exit earlier if error 
-  if (0 != sh_gpg_check_sign (1)) 
-    aud_exit(FIL__, __LINE__, EXIT_FAILURE);
-  */
+  /* do nothing -- we exit earlier if error */
 #else
   sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_START_1H,
@@ -1474,9 +1471,5 @@
     {
 #if (defined(WITH_GPG) || defined(WITH_PGP))
-      /* do nothing -- we exit earlier if error 
-	 if (0 != sh_gpg_check_sign (2)) 
-	 aud_exit(FIL__, __LINE__, EXIT_FAILURE);
-      */
-      ;
+      /* do nothing -- we exit earlier if error */
 #else
       sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_START_2H,
@@ -1489,9 +1482,5 @@
     {
 #if (defined(WITH_GPG) || defined(WITH_PGP))
-      /* do nothing -- we exit earlier if error 
-      if (0 != sh_gpg_check_sign (1)) 
-	aud_exit(FIL__, __LINE__, EXIT_FAILURE);
-      */
-      ;
+      /* do nothing -- we exit earlier if error */
 #else
       sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_START_1H,
Index: trunk/src/sh_unix.c
===================================================================
--- trunk/src/sh_unix.c	(revision 51)
+++ trunk/src/sh_unix.c	(revision 52)
@@ -4122,8 +4122,8 @@
 int sh_unix_getline_stealth (SL_TICKET fd, char * str, int len)
 {
-  int           add_off, llen;
-  unsigned long off_data = 0;
-  unsigned long max_data = 0;
-  static int    stealth_init = BAD;
+  int                  add_off, llen;
+  static unsigned long off_data = 0;
+  static unsigned long max_data = 0;
+  static int           stealth_init = BAD;
 
   SL_ENTER(_("sh_unix_getline_stealth"));
@@ -4144,8 +4144,17 @@
 	}
       stealth_init = GOOD;
+      max_data += off_data;
     }
   
   /* --- Seek to proper position. ---
    */
+  if (off_data >= max_data)
+    {
+      dlog(1, FIL__, __LINE__, 
+	   _("The capacity of the container image file for the stealth config file seems to be too small. Your config file is likely truncated.\n"));
+      sh_error_handle ((-1), FIL__, __LINE__,  EIO, MSG_P_NODATA,
+		       _("Stealth config file."));
+      aud_exit (FIL__, __LINE__, EXIT_FAILURE);
+    }
   sl_seek(fd, off_data);
      
@@ -4154,5 +4163,4 @@
   add_off   = hideout_hex_block(fd, (unsigned char *) str, len);
   off_data += add_off;
-
 
   llen = sl_strlen(str);
Index: trunk/test/testrun_1b.sh
===================================================================
--- trunk/test/testrun_1b.sh	(revision 51)
+++ trunk/test/testrun_1b.sh	(revision 52)
@@ -20,5 +20,5 @@
 #
 
-MAXTEST=2; export MAXTEST
+MAXTEST=3; export MAXTEST
 LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
 RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
@@ -70,4 +70,35 @@
 	    [ -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
 
@@ -171,6 +202,9 @@
 	    log_skip 2 $MAXTEST 'public PGP key 0x0F571F6C not present'
 	else
+	    #
+	    # -------------  first test -------------
+	    #
 	    BUILDOPTS="--quiet $TRUST --enable-debug --with-gpg=${GPG} --with-checksum=no --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}"
+	    testrun1b_internal "${BUILDOPTS}" 
 	    do_test_1b
 	    if [ $? -eq 0 ]; then
@@ -179,9 +213,35 @@
 		log_fail 1 $MAXTEST 'gpg signed config/database files'
 	    fi
+
+
+	    #
+	    # -------------  second 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=no --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   2 $MAXTEST 'gpg signed config/database files'
+		else
+		    log_fail 2 $MAXTEST 'gpg signed config/database files'
+		fi
+	    fi
+
+
+	    #
+	    # -------------  third test -------------
+	    #
 	    PM=`find_path prelude-manager`
 	    if [ -z "$PM" ]; then
-		log_skip 2 $MAXTEST 'prelude-manager not found in $PATH'
+		log_skip 3 $MAXTEST 'prelude-manager not found in $PATH'
 	    elif [ -z "$doall" ]; then
-		log_skip 2 $MAXTEST 'logging to prelude (or use --really-all)'
+		log_skip 3 $MAXTEST 'logging to prelude (or use --really-all)'
 	    else
 		BUILDOPTS="--quiet $TRUST --enable-debug --with-prelude --with-gpg=${GPG} --with-checksum=no --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"
@@ -189,7 +249,7 @@
 		do_test_1b_2
 		if [ $? -eq 0 ]; then
-		    log_ok   2 $MAXTEST 'logging to prelude'
+		    log_ok   3 $MAXTEST 'logging to prelude'
 		else
-		    log_fail 2 $MAXTEST 'logging to prelude'
+		    log_fail 3 $MAXTEST 'logging to prelude'
 		fi
 	    fi
