From: Kevin McCarthy Date: Mon, 2 Jul 2018 03:13:11 +0000 (-0700) Subject: Void passphrase on s/mime decryption error. X-Git-Tag: mutt-1-11-rel~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=099f4dd473cb2936d6fe064539f9951d23c77efc;p=mutt Void passphrase on s/mime decryption error. Model this after pgp's pgp_decrypt_part(), which checks if fpout is empty. --- diff --git a/smime.c b/smime.c index 13a3e2cc..e96daec7 100644 --- a/smime.c +++ b/smime.c @@ -1930,6 +1930,17 @@ static BODY *smime_handle_entity (BODY *m, STATE *s, FILE *outFile) { fflush (smimeout); rewind (smimeout); + + if (type & ENCRYPT) + { + /* void the passphrase, even if that wasn't the problem */ + if (fgetc (smimeout) == EOF) + { + mutt_error _("Decryption failed"); + smime_void_passphrase (); + } + rewind (smimeout); + } if (outFile) fpout = outFile; else @@ -1955,7 +1966,6 @@ static BODY *smime_handle_entity (BODY *m, STATE *s, FILE *outFile) fflush (fpout); rewind (fpout); - if ((p = mutt_read_mime_header (fpout, 0)) != NULL) { fstat (fileno (fpout), &info); @@ -1972,6 +1982,7 @@ static BODY *smime_handle_entity (BODY *m, STATE *s, FILE *outFile) } } + safe_fclose (&smimeout); smimeout = NULL; mutt_unlink (outfile);