Index: trunk/src/sh_sig.c
===================================================================
--- trunk/src/sh_sig.c	(revision 560)
+++ trunk/src/sh_sig.c	(revision 561)
@@ -717,5 +717,5 @@
   sl_rewind (fdTmp);
 
-#if 0
+#if defined(SH_DEBUG_SIGNIFY)
   fin_cp = fdopen(dup(get_the_fd(fdTmp)), "rb");
   FILE * fout = fopen("xxx.out", "w+");
Index: trunk/src/sh_xfer_server.c
===================================================================
--- trunk/src/sh_xfer_server.c	(revision 560)
+++ trunk/src/sh_xfer_server.c	(revision 561)
@@ -1230,9 +1230,4 @@
   int        bytes;
   SL_TICKET  sfd = -1;
-#ifdef SH_ENCRYPT
-  int        blkfac;
-  int        rem;
-  int        send_bytes;
-#endif
 
   if (conn == NULL    || conn->FileName == NULL)
@@ -1281,24 +1276,9 @@
       if (bytes >= 0)
 	{
+	  send_buf = hash_me(conn->K, read_buf,  bytes);
 #ifdef SH_ENCRYPT
-	  /* need to send N * B_SIZ bytes
-	   */ 
-	  blkfac = bytes / B_SIZ;
-	  rem    = bytes - (blkfac * B_SIZ);
-	  if (rem != 0)
-	    {
-	      memset(&read_buf[bytes], '\n', (B_SIZ-rem));
-	      ++blkfac;
-	      send_bytes = blkfac * B_SIZ;
-	    }
-	  else
-	    send_bytes = bytes;
-	  
-	  send_buf = hash_me(conn->K, read_buf,  send_bytes);
-	  
-	  sh_xfer_send_crypt (conn, send_buf, send_bytes+KEY_LEN, _("FILE"),  
+	  sh_xfer_send_crypt (conn, send_buf, bytes+KEY_LEN, _("FILE"),  
 				      SH_PROTO_BIG|conn->client_entry->encf_flag);
 #else
-	  send_buf = hash_me(conn->K, read_buf, bytes);
 	  sh_xfer_send_crypt (conn, send_buf, bytes+KEY_LEN, _("FILE"),  
 				      SH_PROTO_BIG);
Index: trunk/test/test.sh
===================================================================
--- trunk/test/test.sh	(revision 560)
+++ trunk/test/test.sh	(revision 561)
@@ -164,4 +164,5 @@
     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"
 }
@@ -175,5 +176,6 @@
     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"
+    }
 
 #
@@ -715,4 +717,11 @@
     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
@@ -760,4 +769,6 @@
     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
     #
@@ -854,4 +865,8 @@
     MAXTEST=${TEST_MAX}; export MAXTEST
     testrun2g $hostname
+    #
+    . ${SCRIPTDIR}/testrun_2h.sh
+    MAXTEST=${TEST_MAX}; export MAXTEST
+    testrun2h $hostname
     #
     print_summary
Index: trunk/test/testrun_1i.sh
===================================================================
--- trunk/test/testrun_1i.sh	(revision 560)
+++ trunk/test/testrun_1i.sh	(revision 561)
@@ -244,8 +244,8 @@
     fi
     if [ -z "$SIGNIFY" ]; 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 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"
Index: trunk/test/testrun_2h.sh
===================================================================
--- trunk/test/testrun_2h.sh	(revision 561)
+++ trunk/test/testrun_2h.sh	(revision 561)
@@ -0,0 +1,233 @@
+#! /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"
+}
+
