]> granicus.if.org Git - neomutt/commitdiff
Void passphrase on s/mime decryption error
authorKevin McCarthy <kevin@8t8.us>
Mon, 2 Jul 2018 03:13:11 +0000 (20:13 -0700)
committerRichard Russon <rich@flatcap.org>
Sat, 1 Sep 2018 17:06:08 +0000 (18:06 +0100)
Model this after pgp's pgp_decrypt_part(), which checks if fpout is
empty.

ncrypt/smime.c

index cb4b571265cf970e3c070f4b79b952d27fb0d7c2..815742cc728238fc3fdbad5c683ebb42c18c407f 100644 (file)
@@ -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