[Rt-commit] r18456 - rt/3.8/trunk/lib/RT/Crypt

ruz at bestpractical.com ruz at bestpractical.com
Wed Feb 18 23:49:50 EST 2009


Author: ruz
Date: Wed Feb 18 23:49:50 2009
New Revision: 18456

Modified:
   rt/3.8/trunk/lib/RT/Crypt/GnuPG.pm

Log:
* fix verifying of old style signed attachments: we must decode bodies first

Modified: rt/3.8/trunk/lib/RT/Crypt/GnuPG.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Crypt/GnuPG.pm	(original)
+++ rt/3.8/trunk/lib/RT/Crypt/GnuPG.pm	Wed Feb 18 23:49:50 2009
@@ -1064,6 +1064,13 @@
         meta_interactive => 0,
     );
 
+    foreach ( $args{'Data'}, $args{'Signature'} ) {
+        next unless $_->bodyhandle->is_encoded;
+
+        require RT::EmailParser;
+        RT::EmailParser->_DecodeBody($_);
+    }
+
     my ($tmp_fh, $tmp_fn) = File::Temp::tempfile( UNLINK => 1 );
     binmode $tmp_fh, ':raw';
     $args{'Data'}->bodyhandle->print( $tmp_fh );
@@ -1075,7 +1082,9 @@
     my %res;
     eval {
         local $SIG{'CHLD'} = 'DEFAULT';
-        my $pid = safe_run_child { $gnupg->verify( handles => $handles, command_args => [ '-', $tmp_fn ] ) };
+        my $pid = safe_run_child { $gnupg->verify(
+            handles => $handles, command_args => [ '-', $tmp_fn ]
+        ) };
         {
             local $SIG{'PIPE'} = 'IGNORE';
             $args{'Signature'}->bodyhandle->print( $handle{'stdin'} );


More information about the Rt-commit mailing list