[Rt-commit] rt branch, 4.2/smime-v2, updated. rt-4.0.4-516-g23bdbd5
Ruslan Zakirov
ruz at bestpractical.com
Wed May 23 13:41:46 EDT 2012
The branch, 4.2/smime-v2 has been updated
via 23bdbd5bb4aa21d79c2e0519dfe9d299e11c3bf7 (commit)
from c779415f0ffdc4a01229a39c0978893b7b47fdc0 (commit)
Summary of changes:
lib/RT/Crypt.pm | 5 ++++-
t/crypt/no-signer-address.t | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 t/crypt/no-signer-address.t
- Log -----------------------------------------------------------------
commit 23bdbd5bb4aa21d79c2e0519dfe9d299e11c3bf7
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Wed May 23 21:34:58 2012 +0400
avoid scrip death when correspond address is not set
It's misconfiguration when correspond address is not
set in the config and for a queue, but still stack
trace from Crypt.pm into scrip and further is not
helpful.
diff --git a/lib/RT/Crypt.pm b/lib/RT/Crypt.pm
index 8f348d1..87d6889 100644
--- a/lib/RT/Crypt.pm
+++ b/lib/RT/Crypt.pm
@@ -201,7 +201,10 @@ sub SignEncrypt {
if ( $args{'Sign'} && !defined $args{'Signer'} ) {
$args{'Signer'} =
$self->UseKeyForSigning
- || (Email::Address->parse( $entity->head->get( 'From' ) ))[0]->address;
+ || do {
+ my $addr = (Email::Address->parse( $entity->head->get( 'From' ) ))[0];
+ $addr? $addr->address : undef
+ };
}
if ( $args{'Encrypt'} && !$args{'Recipients'} ) {
my %seen;
diff --git a/t/crypt/no-signer-address.t b/t/crypt/no-signer-address.t
new file mode 100644
index 0000000..57c2591
--- /dev/null
+++ b/t/crypt/no-signer-address.t
@@ -0,0 +1,35 @@
+use strict;
+use warnings;
+
+use RT::Test::GnuPG
+ tests => 5,
+ gnupg_options => {
+ passphrase => 'rt-test',
+ 'trust-model' => 'always',
+ }
+;
+
+my $queue;
+{
+ $queue = RT::Test->load_or_create_queue(
+ Name => 'Regression',
+ Sign => 1,
+ );
+ ok $queue && $queue->id, 'loaded or created queue';
+ ok !$queue->CorrespondAddress, 'address not set';
+}
+
+{
+ my $ticket = RT::Ticket->new( RT->SystemUser );
+ my ($status, undef, $msg) = $ticket->Create(
+ Queue => $queue->id,
+ Subject => 'test',
+ Requestor => 'root at localhost',
+ );
+ ok $status, "created ticket" or diag "error: $msg";
+
+ my $log = RT::Test->file_content([RT::Test->temp_directory, 'rt.debug.log']);
+ like $log, qr{secret key not available}, 'error in the log';
+ unlike $log, qr{Scrip .*? died}m, "scrip didn't die";
+}
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list