[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rt-commit
Subject:    [Rt-commit] r8833 - in rt/branches/3.7-EXPERIMENTAL: . lib/RT/Crypt
From:       sartak () bestpractical ! com
Date:       2007-08-30 15:32:25
Message-ID: 20070830153225.014C04D80A2 () diesel ! bestpractical ! com
[Download RAW message or body]

Author: sartak
Date: Thu Aug 30 11:32:24 2007
New Revision: 8833

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm
   rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-bad.t

Log:
 r37628@onn:  sartak | 2007-08-30 11:32:11 -0400
 Now we store the decrypted version even if the signature fails


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm	Thu Aug 30 11:32:24 2007
@@ -1074,9 +1074,14 @@
     $RT::Logger->debug( $res{'status'} ) if $res{'status'};
     $RT::Logger->warning( $res{'error'} ) if $res{'error'};
     $RT::Logger->error( $res{'logger'} ) if $res{'logger'} && $?;
-    if ( $@ || $? ) {
-        $res{'message'} = $@? $@: "gpg exitted with error code ". ($? >> 8);
-        return %res;
+
+    # if the encryption is fine but the signature is bad, then without this
+    # status check we lose the decrypted text
+    if ( $res{'status'} !~ /DECRYPTION_OKAY/ ) {
+        if ( $@ || $? ) {
+            $res{'message'} = $@? $@: "gpg exitted with error code ". ($? >> 8);
+            return %res;
+        }
     }
 
     seek $tmp_fh, 0, 0;

Modified: rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-bad.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-bad.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-bad.t	Thu Aug 30 11:32:24 2007
@@ -1,13 +1,9 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-use Test::More tests => 10;
-use File::Temp;
+use Test::More tests => 14;
 use RT::Test;
 use Cwd 'getcwd';
-use String::ShellQuote 'shell_quote';
-use IPC::Run3 'run3';
-use Digest::MD5 qw(md5_hex);
 
 my $homedir = File::Spec->catdir( getcwd(), qw(lib t data crypt-gnupg) );
 
@@ -39,6 +35,9 @@
 
 diag "good encryption, unknown signer" if $ENV{TEST_VERBOSE};
 {
+    my $signer = RT::Test->load_or_create_user(EmailAddress => 'ruz@bestpractical.com');
+    $signer->PrincipalObj->GrantRight(Right => 'CreateTicket');
+
     email_ok(glob => "encrypted-badsig.txt",
              subject => "test",
              encrypted => 1,
_______________________________________________
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