[Pgp-tools-commit] r702 - trunk/caff
Guilhem Moulin
guilhem-guest at moszumanska.debian.org
Thu Sep 4 20:20:36 UTC 2014
Author: guilhem-guest
Date: 2014-09-04 20:20:35 +0000 (Thu, 04 Sep 2014)
New Revision: 702
Modified:
trunk/caff/caff
Log:
Improve email address parsing (RFC 2822).
Modified: trunk/caff/caff
===================================================================
--- trunk/caff/caff 2014-09-04 20:20:31 UTC (rev 701)
+++ trunk/caff/caff 2014-09-04 20:20:35 UTC (rev 702)
@@ -1740,7 +1740,12 @@
if ($uid->{type} eq 'uat') {
my $attach = ask("UID $uid->{'text'} is an attribute UID, attach it to every email?", 1);
push @attached, $uid if $attach;
- } elsif ($uid->{'text'} !~ /\@/) {
+ } elsif ($uid->{'text'} ~= /.*<([^>]+[\@\N{U+FE6B}\N{U+FF20}][^>]+)>$/) {
+ # XXX This does not cover the full RFC 2822 specification:
+ # The local part may contain '>' in a quoted string.
+ # However as of 1.4.18/2.0.26, gpg doesn't allow that either.
+ $uid->{'address'} = $1;
+ } else {
my $attach = ask("UID $uid->{'text'} is no email address, attach it to every email?", 1);
push @attached, $uid if $attach;
};
@@ -1752,13 +1757,11 @@
my $sendmail = $can_encrypt ? $CONFIG{'mail'} : $CONFIG{'mail-cant-encrypt'};
for my $uid (@UIDS) {
next unless $uid->{last_signed_on}; # wasn't signed by me
- next unless $uid->{type} eq 'uid' and $uid->{'text'} =~ /\@/;
+ next unless defined $uid->{address};
- my $address = $uid->{'text'};
- $address =~ s/.*<(.*)>$/$1/;
- my $mail = create_mail($address, $can_encrypt, $longkeyid, $uid, @attached);
+ my $mail = create_mail($uid->{address}, $can_encrypt, $longkeyid, $uid, @attached);
if (defined $mail) {
- my $should_send_mail = ask("Mail ".($can_encrypt ? '' : '*unencrypted* ')."signature for $uid->{'text'} to '$address'?",
+ my $should_send_mail = ask("Mail ".($can_encrypt ? '' : '*unencrypted* ')."signature for $uid->{'text'} to '$uid->{address}'?",
$sendmail ne 'ask-no', $sendmail eq 'yes', $sendmail eq 'no');
send_message($mail) if $should_send_mail;
More information about the Pgp-tools-commit
mailing list