Index: trunk/aclocal.m4
===================================================================
--- trunk/aclocal.m4	(revision 190)
+++ trunk/aclocal.m4	(revision 191)
@@ -410,5 +410,5 @@
 DESTDIR=
 SH_ENABLE_OPTS="db-reload xml-log message-queue login-watch process-check port-check mounts-check logfile-monitor userfiles debug ptrace static network udp nocl stealth micro-stealth install-name identity khide suidcheck base largefile mail external-scripts encrypt srp dnmalloc"
-SH_WITH_OPTS="prelude libprelude-prefix database libwrap cflags libs console altconsole timeserver alttimeserver rnd egd-socket port logserver altlogserver kcheck gpg checksum fp recipient sender trusted tmp-dir config-file log-file pid-file state-dir data-file html-file"
+SH_WITH_OPTS="prelude libprelude-prefix database libwrap cflags libs console altconsole timeserver alttimeserver rnd egd-socket port logserver altlogserver kcheck gpg keyid checksum fp recipient sender trusted tmp-dir config-file log-file pid-file state-dir data-file html-file"
 
 # Installation directory options.
Index: trunk/configure.ac
===================================================================
--- trunk/configure.ac	(revision 190)
+++ trunk/configure.ac	(revision 191)
@@ -1,3 +1,2 @@
-
 dnl We want to override the standard _AC_INIT_PARSE_ARGS
 dnl
@@ -2147,5 +2146,5 @@
 		  fi
 		else
-		  AC_MSG_WARN([--with-gpg: cannot find GnuPG PATH=${withval}])
+		  AC_MSG_ERROR([--with-gpg: cannot find GnuPG PATH=${withval}])
 		fi
 	  fi
@@ -2154,4 +2153,23 @@
 	  AC_SUBST(mygpg)
 	fi
+	]
+)
+
+AC_ARG_WITH(keyid,
+	[  --with-keyid=KEYID		specify KeyID (0x...) for GPG/PGP functions [[none]]],
+	[
+	if test "x${withval}" != "x"; then
+		echo "${withval}" | awk '{if((length($0)==10)||(length($0)==18)){exit 2}else{exit 0}}' &&
+		AC_MSG_ERROR([--with-keyid:${withval} must be "0x" + 8|16 hex digits])
+		echo "${withval}" | grep ['[^0][^x][^0123456789ABCDEFabcdef]'] >/dev/null 2>&1 &&
+		AC_MSG_ERROR([--with-keyid:${withval} must be "0x" + 8|16 hex digits])
+		mykeyid="$withval"
+		mykeytag="--default-key"
+	else
+		mykeyid=""
+		mykeytag=""
+	fi
+	AC_SUBST(mykeyid)
+	AC_SUBST(mykeytag)
 	]
 )
@@ -2602,4 +2620,8 @@
 	echo "            Log file: ${mylogfile}"
 	echo "            Base key: ${mykeybase}"
+	if test x"$mykeyid" != x
+	then
+	    echo "  target GPG/PGP key: ${mykeyid}"
+	fi
 	echo
 	if test x"$mytclient" = x"-DSH_WITH_SERVER"
Index: trunk/docs/Changelog
===================================================================
--- trunk/docs/Changelog	(revision 190)
+++ trunk/docs/Changelog	(revision 191)
@@ -1,4 +1,5 @@
 2.5.1:
 	* constness patch by Joe MacDonald
+	* GnuPG key ID patch by Jim Dutton
 	
 2.5.0 (01-11-2008):
Index: trunk/docs/TODO
===================================================================
--- trunk/docs/TODO	(revision 190)
+++ trunk/docs/TODO	(revision 191)
@@ -1,7 +1,3 @@
-gcc -g -DDNMALLOC_DEBUG=1 -DUSE_MALLOC_LOCK=1 -Wall -O2 -o dnmalloc-1.0.beta5-rw.o -c   src/dnmalloc-1.0.beta5-rw.c
 
-gcc -g -Wall -O2 -o t-test.o -c src/t-test1.c
-gcc -g -DUSE_MALLOC_LOCK=1 -Wall -O2 -o dnmalloc-1.0.beta5-rw.o -c   src/dnmalloc-1.0.beta5-rw.c
-gcc -g -lpthread -o t-test t-test.o dnmalloc-1.0.beta5-rw.o
-./t-test
+Patch for 'setmailport'
 
Index: trunk/samhain-install.sh.in
===================================================================
--- trunk/samhain-install.sh.in	(revision 190)
+++ trunk/samhain-install.sh.in	(revision 191)
@@ -1312,4 +1312,6 @@
 
     GPGPATH=@mygpg@
+    TARGETKEYID=@mykeyid@
+    KEYTAG=@mykeytag@
 
     NTEST=@mytclient@
@@ -1356,5 +1358,5 @@
 	echo "You need to sign the config file now"
 	echo
-	test -z "$verbose" || echo "  ${GPGPATH} -a --clearsign $RCFILE"
+	test -z "$verbose" || echo "  ${GPGPATH} -a ${KEYTAG} ${TARGETKEYID} --clearsign $RCFILE"
 	if test x"${NTEST}" = "x-DSH_WITH_SERVER"
 	then
@@ -1365,10 +1367,10 @@
 		DOT_GNUPG=`eval echo ~${samhain}/.gnupg`
 	        test -z "$verbose" || echo "  using --homedir ${DOT_GNUPG}"
-		${GPGPATH} --homedir ${DOT_GNUPG} -a --clearsign $RCFILE
+		${GPGPATH} --homedir ${DOT_GNUPG} -a ${KEYTAG} ${TARGETKEYID} --clearsign $RCFILE
 	    else
-		${GPGPATH} -a --clearsign $RCFILE
-	    fi
-	else
-	    ${GPGPATH} -a --clearsign $RCFILE
+		${GPGPATH} -a ${KEYTAG} ${TARGETKEYID} --clearsign $RCFILE
+	    fi
+	else
+	    ${GPGPATH} -a ${KEYTAG} ${TARGETKEYID} --clearsign $RCFILE
 	fi
 
Index: trunk/scripts/samhainadmin.pl.in
===================================================================
--- trunk/scripts/samhainadmin.pl.in	(revision 190)
+++ trunk/scripts/samhainadmin.pl.in	(revision 191)
@@ -50,4 +50,7 @@
 my $daemon   = "@sbindir@/@install_name@";
 my $gpg      = "@mygpg@";
+
+my $TARGETKEYID = "@mykeyid@";
+my $KEYTAG      = "@mykeytag@";
 
 $cfgfile  =~ s/^REQ_FROM_SERVER//;
@@ -502,10 +505,10 @@
     if (defined($passphrase)) {
 	local $SIG{PIPE} = 'IGNORE';
-	my $command = "$gpg --homedir $ENV{'HOME'}/.gnupg --passphrase-fd 0 -a --clearsign -o $fileout --not-dash-escaped $file1";
+	my $command = "$gpg --homedir $ENV{'HOME'}/.gnupg --passphrase-fd 0 -a ${KEYTAG} ${TARGETKEYID} --clearsign -o $fileout --not-dash-escaped $file1";
 	open (FH, "|$command")  or die "can't fork: $!";
 	print FH "$passphrase"  or die "can't write: $!";
 	close FH                or die "can't close: status=$?";
     } else {
-	my $command = "$gpg --homedir $ENV{'HOME'}/.gnupg                   -a --clearsign -o $fileout --not-dash-escaped $file1";
+	my $command = "$gpg --homedir $ENV{'HOME'}/.gnupg                   -a ${KEYTAG} ${TARGETKEYID} --clearsign -o $fileout --not-dash-escaped $file1";
 	system("$command") == 0 
 	    or die "system $command failed: $?";
