[Rt-commit] rt branch, 4.4/report-smime-signer-and-issuer-correctly, created. rt-4.4.4-147-g2934e3b212
Dianne Skoll
dianne at bestpractical.com
Tue Nov 3 10:11:48 EST 2020
The branch, 4.4/report-smime-signer-and-issuer-correctly has been created
at 2934e3b2126c86f6073d4ad4b9d95ec7e3c6db89 (commit)
- Log -----------------------------------------------------------------
commit 34ae23594d8c1ed0d8ef9b3ca77cb6c266f036f7
Author: Dianne Skoll <dianne at bestpractical.com>
Date: Tue Nov 3 09:47:46 2020 -0500
Report the S/MIME signer correctly; also report the cert authority in an "assured by ..." clause.
diff --git a/lib/RT/Crypt/SMIME.pm b/lib/RT/Crypt/SMIME.pm
index 5ea826327c..9ebfc66668 100644
--- a/lib/RT/Crypt/SMIME.pm
+++ b/lib/RT/Crypt/SMIME.pm
@@ -533,7 +533,7 @@ sub Verify {
$res{'status'} = $self->FormatStatus({
Operation => "Verify", Status => "DONE",
- Message => "The signature is good, signed by ".$signer->{User}[0]{String}.", trust is ".$signer->{TrustTerse},
+ Message => "The signature is good, signed by ".$signer->{User}[0]{String}.", assured by " . $signer->{Issuer}[0]{String} . ", trust is ".$signer->{TrustTerse},
UserString => $signer->{User}[0]{String},
Trust => uc($signer->{TrustTerse}),
});
@@ -933,8 +933,11 @@ sub GetCertificateInfo {
my $method = $type . "_" . $USER_MAP{$_};
$data{$_} = $cert->$method if $cert->can($method);
}
- $data{String} = Email::Address->new( @data{'Name', 'EmailAddress'} )->format
- if $data{EmailAddress};
+ if ($data{EmailAddress}) {
+ $data{String} = Email::Address->new( @data{'Name', 'EmailAddress'} )->format;
+ } else {
+ $data{String} = $data{Name};
+ }
return \%data;
};
commit 2934e3b2126c86f6073d4ad4b9d95ec7e3c6db89
Author: Dianne Skoll <dianne at bestpractical.com>
Date: Tue Nov 3 10:07:40 2020 -0500
Fix unit test to cope with variations in how different versions of OpenSSL print certificates.
diff --git a/t/crypt/smime/other-certs.t b/t/crypt/smime/other-certs.t
index 1b4407586b..ee067192d1 100644
--- a/t/crypt/smime/other-certs.t
+++ b/t/crypt/smime/other-certs.t
@@ -28,6 +28,13 @@ ok( !$err, 'no errors' );
chomp $cert;
open my $fh, '<', RT::Test::SMIME->key_path( 'sender at example.com.crt' ) or die $!;
my $sender_cert = do { local $/; <$fh> };
+
+# Variations in how different versions of OpenSSL print certificates
+# can lead to incorrect test falures. So only compare the *actual*
+# certificate data between the BEGIN CERTIFICATE and END CERTIFICATE lines
+$cert =~ s/.*-----BEGIN CERTIFICATE-----/-----BEGIN CERTIFICATE-----/s;
+$sender_cert =~ s/.*-----BEGIN CERTIFICATE-----/-----BEGIN CERTIFICATE-----/s;
+
is( $cert, $sender_cert, 'cert is the same one' );
diag "Has OtherCertificatesToSend";
@@ -56,6 +63,14 @@ is( scalar @certs, 2, 'found 2 certs' );
open $fh, '<', RT::Test::SMIME->key_path( 'demoCA', 'cacert.pem' ) or die $!;
my $ca_cert = do { local $/; <$fh> };
+
+# Variations in how different versions of OpenSSL print certificates
+# can lead to incorrect test falures. So only compare the *actual*
+# certificate data between the BEGIN CERTIFICATE and END CERTIFICATE lines
+$certs[0] =~ s/.*-----BEGIN CERTIFICATE-----/-----BEGIN CERTIFICATE-----/s;
+$certs[1] =~ s/.*-----BEGIN CERTIFICATE-----/-----BEGIN CERTIFICATE-----/s;
+$ca_cert =~ s/.*-----BEGIN CERTIFICATE-----/-----BEGIN CERTIFICATE-----/s;
+
is( $certs[0], $ca_cert, 'got ca cert' );
is( $certs[1], $sender_cert, 'got sender cert' );
-----------------------------------------------------------------------
More information about the rt-commit
mailing list