diff options
author | Kevin McCarthy <kevin@8t8.us> | 2020-04-09 11:22:07 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2020-04-09 13:25:39 -0700 |
commit | 53a1b4ceeed7b14cdd5b8f4b4ae39143cbef2985 (patch) | |
tree | 37f5f1187a266e207b59de17ff2315542e8b03fd /pgp.c | |
parent | 4fc97a2026f671a35e3d296bbfdeb3794d6313c7 (diff) |
Convert "non-fatal" handler errors to return 1 instead of -1.
When displaying a message, display a mutt_error() to warn of
incomplete rendering.
Fix mutt_copy_message() to check for ferror and feof errors on partial
decode too.
Clean up _mutt_append_message() to not pass a partial-decode along as
a success.
Modify the crypt handlers to return 1 if any kind of state message is
displayed. There is some fuzzyness about what a "fatal" error is, but
for now just consider a handler error that notifies by
state_attach_puts() as "non-fatal".
Diffstat (limited to 'pgp.c')
-rw-r--r-- | pgp.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -1022,7 +1022,6 @@ BODY *pgp_decrypt_part (BODY *a, STATE *s, FILE *fpout, BODY *p) p->goodsig = 1; else p->goodsig = 0; - state_attach_puts (_("[-- End of PGP output --]\n\n"), s); } safe_fclose (&pgperr); @@ -1153,7 +1152,7 @@ int pgp_encrypted_handler (BODY *a, STATE *s) BUFFER *tempfile = NULL; FILE *fpout, *fpin; BODY *tattach; - int rc = -1; + int rc = 1; tempfile = mutt_buffer_pool_get (); mutt_buffer_mktemp (tempfile); @@ -1164,9 +1163,15 @@ int pgp_encrypted_handler (BODY *a, STATE *s) goto cleanup; } - if (s->flags & MUTT_DISPLAY) crypt_current_time (s, "PGP"); + if (s->flags & MUTT_DISPLAY) + crypt_current_time (s, "PGP"); - if ((tattach = pgp_decrypt_part (a, s, fpout, a)) != NULL) + tattach = pgp_decrypt_part (a, s, fpout, a); + + if (s->flags & MUTT_DISPLAY) + state_attach_puts (_("[-- End of PGP output --]\n\n"), s); + + if (tattach != NULL) { if (s->flags & MUTT_DISPLAY) { @@ -1222,8 +1227,9 @@ int pgp_encrypted_handler (BODY *a, STATE *s) } else { - mutt_error _("Could not decrypt PGP message"); - mutt_sleep (2); + if (s->flags & MUTT_DISPLAY) + state_attach_puts (_("[-- Error: decryption failed --]\n\n"), s); + /* void the passphrase, even if it's not necessarily the problem */ pgp_void_passphrase (); } |