[prev in list] [next in list] [prev in thread] [next in thread]
List: rt-commit
Subject: [Rt-commit] rt branch, 4.4/add-crypt-status-functions, updated. rt-4.4.4-175-ga11c3094c5
From: dianne () bestpractical ! com (Dianne Skoll)
Date: 2020-11-24 21:46:23
Message-ID: 20201124214623.EBA7E2418004 () booth ! bestpractical ! com
[Download RAW message or body]
The branch, 4.4/add-crypt-status-functions has been updated
via a11c3094c5aef7072c8f6248ac9ed4bf5db6c8fc (commit)
from 46d3b0d9754022a50a1bfa699cc317cf3837ee3a (commit)
Summary of changes:
lib/RT/Attachment.pm | 10 +++++-----
t/mail/gnupg-incoming.t | 2 +-
t/mail/smime/incoming.t | 16 ++++++++++++++--
3 files changed, 20 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit a11c3094c5aef7072c8f6248ac9ed4bf5db6c8fc
Author: Dianne Skoll <dianne@bestpractical.com>
Date: Tue Nov 24 16:45:30 2020 -0500
Don't short-circuit GetCryptStatus when we hit the first crypto status header; \
process them all.
diff --git a/lib/RT/Attachment.pm b/lib/RT/Attachment.pm
index 355ca5fd7c..f587309d1c 100644
--- a/lib/RT/Attachment.pm
+++ b/lib/RT/Attachment.pm
@@ -874,20 +874,20 @@ in L<RT::Crypt::ParseStatus>; however, each hashref has one \
additional entry 'Protocol' which is the name of the crypto protocol used
and is one of 'SMIME' or 'GnuPG'.
-If no crypto header exists, returns the array: ( { Protocol => 'None' } )
+If no crypto header exists, returns an empty array
=cut
sub GetCryptStatus
{
my $self = shift;
- my @result = ( {Protocol => 'None' } );
+ my @ret = ( );
foreach my $h ($self->SplitHeaders) {
next unless $h =~ /^X-RT-(GnuPG|SMIME)-Status:/i;
my $protocol = $1;
my ($h_key, $h_val) = split(/:\s*/, $h, 2);
- @result = RT::Crypt->ParseStatus(Protocol => $protocol,
+ my @result = RT::Crypt->ParseStatus(Protocol => $protocol,
Status => $h_val);
# Canonicalize protocol case so it's always SMIME or GnuPG
@@ -898,10 +898,10 @@ sub GetCryptStatus
}
foreach my $hash (@result) {
$hash->{'Protocol'} = $protocol;
+ push(@ret, $hash);
}
- last;
}
- return @result;
+ return @ret;
}
=head2 SplitHeaders
diff --git a/t/mail/gnupg-incoming.t b/t/mail/gnupg-incoming.t
index c8a4fcc678..a7b1bc4349 100644
--- a/t/mail/gnupg-incoming.t
+++ b/t/mail/gnupg-incoming.t
@@ -65,7 +65,7 @@ RT::Test->close_mailgate_ok($mail);
like( $txn->Attachments->First->Content, qr/Blah/);
my ($msg) = @{$txn->Attachments->ItemsArrayRef};
my @status = $msg->GetCryptStatus;
- cmp_deeply(\@status, [{Protocol => 'None'}], 'Got expected crypt status \
(Protocol => None)'); + cmp_deeply(\@status, [], 'Got empty array for \
unsigned/unencrypted attachment'); }
# test for signed mail
diff --git a/t/mail/smime/incoming.t b/t/mail/smime/incoming.t
index 6b798916f9..27b9edd16a 100644
--- a/t/mail/smime/incoming.t
+++ b/t/mail/smime/incoming.t
@@ -55,7 +55,7 @@ RT::Test->close_mailgate_ok($mail);
like( $txn->Attachments->First->Content, qr'Blah');
my ($msg) = @{$txn->Attachments->ItemsArrayRef};
my @status = $msg->GetCryptStatus;
- cmp_deeply(\@status, [{Protocol => 'None'}], 'Got expected crypt status \
(Protocol => None)'); + cmp_deeply(\@status, [], 'Got expected crypt status (Empty \
array)'); }
{
@@ -145,7 +145,19 @@ RT::Test->close_mailgate_ok($mail);
Protocol => 'SMIME',
Message => 'Decryption process succeeded',
EncryptedTo => [{EmailAddress => 'sender@example.com'}],
- Status => 'DONE'}], 'Got expected encryption status');
+ Status => 'DONE'},
+ {
+ Status => 'DONE',
+ UserString => '"Enoch Root" <root@example.com>',
+ Trust => 'FULL',
+ Issuer => '"CA Owner" <ca.owner@example.com>',
+ CreatedTimestamp => re('^\d+$'),
+ Message => 'The signature is good, signed by "Enoch Root" \
<root@example.com>, assured by "CA Owner" <ca.owner@example.com>, trust is full', + \
ExpireTimestamp => re('^\d+$'), + Operation => 'Verify',
+ Protocol => 'SMIME'
+ }
+ ], 'Got expected signing/encryption status');
}
{
-----------------------------------------------------------------------
_______________________________________________
rt-commit mailing list
rt-commit@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic