diff options
author | David Shaw <dshaw@jabberwocky.com> | 2002-09-16 16:35:19 +0200 |
---|---|---|
committer | David Shaw <dshaw@jabberwocky.com> | 2002-09-16 16:35:19 +0200 |
commit | 81c8f7daca6d0776c15db65500e765fabac587b4 (patch) | |
tree | c016f862571a45d13d9e49e48fa3b39e98a5d4b0 /keyserver/gpgkeys_mailto.in | |
parent | * gpg.sgml: Add rebuild-keydb-caches. (diff) | |
download | gnupg2-81c8f7daca6d0776c15db65500e765fabac587b4.tar.xz gnupg2-81c8f7daca6d0776c15db65500e765fabac587b4.zip |
* gpgkeys_mailto.in: Add quasi-RFC-2368 mailto:email@addr?from= syntax so
people can set their own email address to respond to.
* gpgkeys_hkp.c (get_key): Properly respond with KEY FAILED (to gpg) and
"key not found" (to user) on failure.
Diffstat (limited to 'keyserver/gpgkeys_mailto.in')
-rwxr-xr-x | keyserver/gpgkeys_mailto.in | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/keyserver/gpgkeys_mailto.in b/keyserver/gpgkeys_mailto.in index d2bde094d..9086de419 100755 --- a/keyserver/gpgkeys_mailto.in +++ b/keyserver/gpgkeys_mailto.in @@ -38,6 +38,8 @@ if(@ARGV) ($login,$name)=(getpwuid($<))[0,6]; +$from="$name <$login>"; + while(<STDIN>) { last if($_ eq "\n"); @@ -78,6 +80,29 @@ if(!defined($address)) exit(1); } +# decode $address + +($address,$args)=split(/\?/,$address); + +if(defined($args)) +{ + @pairs = split(/&/, $args); + foreach $pair (@pairs) + { + ($hdr, $val) = split(/=/, $pair); + $hdr =~ tr/+/ /; + $hdr =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + $val =~ tr/+/ /; + $val =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; +# we only handle "from" right now + if($hdr=~/^from$/i) + { + $from=$val; + last; + } + } +} + while(<STDIN>) { last if($_ eq "\n"); @@ -104,7 +129,7 @@ if($command=~/get/i || $command=~/search/i) foreach $key (@keys) { open(MAIL,"|$sendmail") || die "ERROR: Can't open $sendmail\n"; - print MAIL "From: $name <$login>\n"; + print MAIL "From: $from\n"; print MAIL "To: $address\n"; if($command=~/get/i) { |