From 024cc5997501e19bd08ad3bbd1593bfe827cd6ca Mon Sep 17 00:00:00 2001 From: David Shaw Date: Fri, 28 Dec 2001 16:36:47 +0000 Subject: [PATCH] gpgkeys_ldap: Close files explicitly when exiting gpgkeys_mailto: Use the outofband flag so gpg doesn't expect any actual data --- keyserver/ChangeLog | 9 +++++++++ keyserver/gpgkeys_ldap.c | 6 ++++++ keyserver/gpgkeys_mailto.in | 15 ++++++++++++--- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/keyserver/ChangeLog b/keyserver/ChangeLog index 99ad7c5d0..f51d37494 100644 --- a/keyserver/ChangeLog +++ b/keyserver/ChangeLog @@ -1,3 +1,12 @@ +2001-12-28 David Shaw + + * gpgkeys_mailto.in: Use the new OUTOFBAND indicator so gpg knows + not to try and import anything. Also turn on perl -w for + warnings. + + * gpgkeys_ldap.c (main): If we're using temp files (rather than + stdin/stdout), make sure the file is closed when we're done. + 2001-12-20 David Shaw * Properly free the LDAP response when we're done with it. diff --git a/keyserver/gpgkeys_ldap.c b/keyserver/gpgkeys_ldap.c index 4e8467b04..3f979cb21 100644 --- a/keyserver/gpgkeys_ldap.c +++ b/keyserver/gpgkeys_ldap.c @@ -930,6 +930,12 @@ int main(int argc,char *argv[]) fail: + if(input!=stdin) + fclose(input); + + if(output!=stdout) + fclose(output); + if(ldap!=NULL) ldap_unbind_s(ldap); diff --git a/keyserver/gpgkeys_mailto.in b/keyserver/gpgkeys_mailto.in index 053a8b633..d978a6797 100755 --- a/keyserver/gpgkeys_mailto.in +++ b/keyserver/gpgkeys_mailto.in @@ -1,4 +1,4 @@ -#!@PERL@ +#!@PERL@ -w # gpgkeys_mailto - talk to a email keyserver # Copyright (C) 2001 Free Software Foundation, Inc. @@ -58,8 +58,7 @@ while() { $verbose++; } - - if($1=~/^no-verbose$/i) + elsif($1=~/^no-verbose$/i) { $verbose--; } @@ -75,10 +74,20 @@ while() push(@keys,$_); } +# Send response + +print "VERSION 0\n"; +print "OPTION OUTOFBAND\n\n"; + # Email keyservers get and search the same way if($command=~/get/i || $command=~/search/i) { + if($command=~/search/i) + { + print "COUNT 0\n"; + } + foreach $key (@keys) { open(MAIL,"|$sendmail") || die "ERROR: Can't open $sendmail\n";