[Rt-commit] r18115 - in rt/3.8/trunk: t/data/gnupg/emails t/mail
ruz at bestpractical.com
ruz at bestpractical.com
Sun Feb 1 09:17:17 EST 2009
Author: ruz
Date: Sun Feb 1 09:17:16 2009
New Revision: 18115
Added:
rt/3.8/trunk/t/data/gnupg/emails/19-signed-inline-plain-nested.txt
Modified:
rt/3.8/trunk/lib/RT/Crypt/GnuPG.pm
rt/3.8/trunk/t/mail/gnupg-realmail.t
Log:
* handle mails with nested inline signatures in old-style gpg format
Modified: rt/3.8/trunk/lib/RT/Crypt/GnuPG.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Crypt/GnuPG.pm (original)
+++ rt/3.8/trunk/lib/RT/Crypt/GnuPG.pm Sun Feb 1 09:17:16 2009
@@ -1269,6 +1269,9 @@
while ( defined(my $str = $io->getline) ) {
if ( $in_block && $str =~ /-----END PGP (?:MESSAGE|SIGNATURE)-----/ ) {
print $block_fh $str;
+ $in_block--;
+ next if $in_block > 0;
+
seek $block_fh, 0, 0;
my ($res_fh, $res_fn);
@@ -1289,8 +1292,11 @@
binmode $block_fh, ':raw';
$in_block = 0;
}
- elsif ( $in_block || $str =~ /-----BEGIN PGP (SIGNED )?MESSAGE-----/ ) {
- $in_block = 1;
+ elsif ( $str =~ /-----BEGIN PGP (SIGNED )?MESSAGE-----/ ) {
+ $in_block++;
+ print $block_fh $str;
+ }
+ elsif ( $in_block ) {
print $block_fh $str;
}
else {
Added: rt/3.8/trunk/t/data/gnupg/emails/19-signed-inline-plain-nested.txt
==============================================================================
--- (empty file)
+++ rt/3.8/trunk/t/data/gnupg/emails/19-signed-inline-plain-nested.txt Sun Feb 1 09:17:16 2009
@@ -0,0 +1,34 @@
+Received: by anduril (Postfix, from userid 1000)
+ id 3EDA537F80; Mon, 13 Aug 2007 15:34:17 -0400 (EDT)
+Date: Mon, 13 Aug 2007 15:34:17 -0400
+To: rt-recipient at example.com
+Subject: Test Email ID:19
+Message-ID: <20070813193417.GD6392 at mit.edu>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii; x-action=pgp-signed
+Content-Disposition: inline
+User-Agent: Mutt/1.5.13 (2006-08-11)
+From: ternus at mit.edu (Christian Ternus)
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+- -----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+This is a test email with inline nested signature.
+ID:19
+- -----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.9 (Darwin)
+
+iEYEARECAAYFAkmETNkACgkQ0ygDXYSIHxv3ewCgijZQyL5vWIOfk+06XjqTXdrN
+VDcAnj13TCHvhas6rMtxcljNNGvPidw6
+=VMc6
+- -----END PGP SIGNATURE-----
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.9 (Darwin)
+
+iEYEARECAAYFAkmETOIACgkQ0ygDXYSIHxvvvQCfZlRPNjt77jJ7ANxwOpkHkwCY
+wsIAn0PzLhCKhIcAm+hk8CpduzYcY0xW
+=Xy5t
+-----END PGP SIGNATURE-----
Modified: rt/3.8/trunk/t/mail/gnupg-realmail.t
==============================================================================
--- rt/3.8/trunk/t/mail/gnupg-realmail.t (original)
+++ rt/3.8/trunk/t/mail/gnupg-realmail.t Sun Feb 1 09:17:16 2009
@@ -10,7 +10,7 @@
plan skip_all => 'gpg executable is required.'
unless RT::Test->find_executable('gpg');
-plan tests => 176;
+plan tests => 183;
use Digest::MD5 qw(md5_hex);
@@ -64,6 +64,14 @@
}
}
+$eid = 18;
+{
+ my ($usage, $format, $attachment) = ('signed', 'inline', 'plain');
+ ++$eid;
+ diag "Email $eid: $usage, $attachment email with $format format" if $ENV{TEST_VERBOSE};
+ eval { email_ok($eid, $usage, $format, $attachment) };
+}
+
sub email_ok {
my ($eid, $usage, $format, $attachment) = @_;
diag "email_ok $eid: $usage, $format, $attachment" if $ENV{'TEST_VERBOSE'};
More information about the Rt-commit
mailing list