From 2cca04bc303a0cfbc28b86714b6d7a3e03d16b7d Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Tue, 2 Aug 2005 05:03:43 +0000 Subject: [PATCH] Forget passphrase on PGP/inline decryption error, and improve status line messages. --- pgp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pgp.c b/pgp.c index 8ce45efd..895a9e43 100644 --- 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 -- 2.40.0