tag 298556 patch
thanks for all the fish

On Tue, 08 Mar 2005, [EMAIL PROTECTED] wrote:

> When I upgrade gnupg to newest available in sarge version, I cannot
> decrypt files using GnuPG.

Note that GnuPG.pm is quite unmaintained upstream (last release in
2001).  I prefer using GnuPG::Interface, but that doesn't abstract
things so nicely, so you get to handle those problems yourself.

Anyway, looks like this patch fixes it, can you confirm?

-- 
 PGP signed and encrypted  |  .''`.  ** Debian GNU/Linux **
    messages preferred.    | : :' :      The  universal
                           | `. `'      Operating System
 http://www.palfrader.org/ |   `-    http://www.debian.org/
--- GnuPG.pm    2004-05-12 02:45:27.000000000 +0200
+++ GnuPG.pm.new        2005-03-08 15:22:51.094360730 +0100
@@ -727,19 +727,27 @@
 sub decrypt_postread($) {
     my $self = shift;
 
+    my @cmds;
     # gnupg 1.0.2 adds this status message
     my ( $cmd, $arg ) = $self->read_from_status;
+    push @cmds, $cmd;
 
-    ( $cmd, $arg ) = $self->read_from_status()
-      if $cmd =~ /BEGIN_DECRYPTION/;
+    if ($cmd =~ /BEGIN_DECRYPTION/) {
+       ( $cmd, $arg ) = $self->read_from_status();
+       push @cmds, $cmd;
+    };
 
     my $sig = undef;
-    if ( $cmd =~ /SIG_ID/ ) {
-       $sig = $self->check_sig( $cmd, $arg );
-       ( $cmd, $arg ) = $self->read_from_status;
-    }
+    while (defined $cmd && !($cmd =~ /DECRYPTION_OKAY/)) {
+       if ( $cmd =~ /SIG_ID/ ) {
+           $sig = $self->check_sig( $cmd, $arg );
+       }
+       ( $cmd, $arg ) = $self->read_from_status();
+       push @cmds, $cmd if defined $cmd;
+    };
 
-    $self->abort_gnupg( "protocol error: expected DECRYPTION_OKAY got $cmd: 
\n" )
+    my $cmds = join ', ', @cmds;
+    $self->abort_gnupg( "protocol error: expected DECRYPTION_OKAY but never 
got it (all I saw was: $cmds): \n" )
       unless $cmd =~ /DECRYPTION_OKAY/;
 
     return $sig ? $sig : 1;

Reply via email to