From 7c57091f10e4e89fb89e84a0018b0651447c09f6 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Mon, 4 May 2009 03:03:38 +0000 Subject: [PATCH] * gpgkeys_mailto.in: Set 'mail-from' as a keyserver-option, rather than the ugly ?from= syntax. --- keyserver/ChangeLog | 5 +++++ keyserver/gpgkeys_mailto.in | 42 +++++++++++++------------------------ 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/keyserver/ChangeLog b/keyserver/ChangeLog index f332051fb..ff3bac54d 100644 --- a/keyserver/ChangeLog +++ b/keyserver/ChangeLog @@ -1,3 +1,8 @@ +2009-05-03 David Shaw + + * gpgkeys_mailto.in: Set 'mail-from' as a keyserver-option, rather + than the ugly ?from= syntax. + 2009-04-20 David Shaw * gpgkeys_hkp.c (srv_replace): New function to transform a SRV diff --git a/keyserver/gpgkeys_mailto.in b/keyserver/gpgkeys_mailto.in index fd422f430..c491390da 100755 --- a/keyserver/gpgkeys_mailto.in +++ b/keyserver/gpgkeys_mailto.in @@ -52,10 +52,6 @@ if(@ARGV) open(STDIN,$ARGV[0]) || die "Can't open input file $ARGV[0]\n"; } -($login,$name)=(getpwuid($<))[0,6]; - -$from="$name <$login>"; - while() { last if($_ eq "\n"); @@ -85,9 +81,24 @@ while() { $verbose--; } + elsif($1=~/^mail-from=(.+)$/i) + { + $from=$1; + } + elsif($1=~/^no-mail-from$/i) + { + undef $from; + } + } } +if(!defined($from)) +{ + ($login,$name)=(getpwuid($<))[0,6]; + $from="$name <$login>"; +} + $program="(unknown)" if(!defined($program)); if(!defined($address)) @@ -96,29 +107,6 @@ 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() { last if($_ eq "\n");