]> granicus.if.org Git - neomutt/commitdiff
Forget passphrase on PGP/inline decryption error, and improve status line
authorBrendan Cully <brendan@kublai.com>
Tue, 2 Aug 2005 05:03:43 +0000 (05:03 +0000)
committerBrendan Cully <brendan@kublai.com>
Tue, 2 Aug 2005 05:03:43 +0000 (05:03 +0000)
messages.

pgp.c

diff --git a/pgp.c b/pgp.c
index 8ce45efd61604742bea92ef079f3135eb82ac272..895a9e4314e298175af6af8bd1138f6a655eddab 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -381,7 +381,18 @@ void pgp_application_pgp_handler (BODY *m, STATE *s)
        }
       }
       
+      /* treat empty result as sign of failure */
+      if (! ftell(pgpout))
+      {
+        mutt_error _("Could not decrypt PGP message");
+        pgp_void_passphrase ();
 
+       safe_fclose (&tmpfp);
+       mutt_unlink (tmpfname);
+        safe_fclose (&pgpout);
+       mutt_unlink (outfile);
+        return;
+      }
       /*
        * Now, copy cleartext to the screen.  NOTE - we expect that PGP
        * outputs utf-8 cleartext.  This may not always be true, but it 
@@ -420,7 +431,10 @@ void pgp_application_pgp_handler (BODY *m, STATE *s)
       {
        state_putc ('\n', s);
        if (needpass)
+        {
          state_attach_puts (_("[-- END PGP MESSAGE --]\n"), s);
+          mutt_message _("PGP message successfully decrypted.");
+        }
        else if (pgp_keyblock)
          state_attach_puts (_("[-- END PGP PUBLIC KEY BLOCK --]\n"), s);
        else