[Rt-commit] rt branch, 4.2/smime-v2, updated. rt-4.0.4-556-g1fe6aed
Ruslan Zakirov
ruz at bestpractical.com
Mon Dec 31 06:54:16 EST 2012
The branch, 4.2/smime-v2 has been updated
via 1fe6aed9a3b5b9d781698d860c4b60f87c6f6893 (commit)
from d60801c786c92e5d18fb80ae4828ba79eee3ed7b (commit)
Summary of changes:
lib/RT/Crypt/SMIME.pm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit 1fe6aed9a3b5b9d781698d860c4b60f87c6f6893
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Sat Dec 29 18:29:29 2012 +0400
make SMIME more verbose on how it looks for keys
Now, if key is not there then log doesn't indicate problem,
it only says that decryption failed.
diff --git a/lib/RT/Crypt/SMIME.pm b/lib/RT/Crypt/SMIME.pm
index a0d8774..889f725 100644
--- a/lib/RT/Crypt/SMIME.pm
+++ b/lib/RT/Crypt/SMIME.pm
@@ -460,7 +460,10 @@ sub _Decrypt {
my $found_key = 0;
foreach my $address ( @addresses ) {
my $key_file = File::Spec->catfile( $keyring, $address .'.pem' );
- next unless -e $key_file && -r _;
+ unless ( -e $key_file && -r _ ) {
+ $RT::Logger->debug("No '$key_file' or it's unreadable");
+ next;
+ }
$found_key = 1;
@@ -476,10 +479,14 @@ sub _Decrypt {
safe_run_child { run3( $cmd, $args{'Content'}, \$buf, \$res{'stderr'} ) };
unless ( $? ) {
$encrypted_to = $address;
+ $RT::Logger->debug("Message encrypted for $encrypted_to");
last;
}
- next if index($res{'stderr'}, 'no recipient matches key') >= 0;
+ if ( index($res{'stderr'}, 'no recipient matches key') >= 0 ) {
+ $RT::Logger->debug("Message was sent to $address and we have key, but it's not encrypted for this address");
+ next;
+ }
$res{'exit_code'} = $?;
$res{'message'} = "openssl exitted with error code ". ($? >> 8)
@@ -493,6 +500,7 @@ sub _Decrypt {
return (undef, %res);
}
unless ( $found_key ) {
+ $RT::Logger->error("Couldn't find SMIME key for addresses: ". join ', ', @addresses);
$res{'exit_code'} = 1;
$res{'status'} = $self->FormatStatus({
Operation => 'KeyCheck',
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list