From e38bbf8ec81c5b5960d7e299b7c15dcb96a23c63 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Sun, 1 Jul 2018 20:13:11 -0700 Subject: [PATCH] Void passphrase on s/mime decryption error Model this after pgp's pgp_decrypt_part(), which checks if fpout is empty. --- ncrypt/smime.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ncrypt/smime.c b/ncrypt/smime.c index cb4b57126..815742cc7 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -2118,6 +2118,17 @@ static struct Body *smime_handle_entity(struct Body *m, struct State *s, FILE *o 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_class_void_passphrase(); + } + rewind(smimeout); + } + if (out_file) fpout = out_file; else -- 2.40.0