]> granicus.if.org Git - neomutt/commitdiff
Don't try to decrypt autocrypt messages if the option is off
authorKevin McCarthy <kevin@8t8.us>
Sun, 4 Aug 2019 14:55:26 +0000 (07:55 -0700)
committerRichard Russon <rich@flatcap.org>
Mon, 19 Aug 2019 23:14:27 +0000 (00:14 +0100)
Co-authored-by: Richard Russon <rich@flatcap.org>
ncrypt/cryptglue.c

index 27f002de6967a7aae9ae03c6c64f0fe29a40aa24..a096c89ade1c88b2b5daae13f78600fd11f2cec9 100644 (file)
@@ -41,6 +41,7 @@
 #include "mutt/mutt.h"
 #include "crypt_mod.h"
 #include "curs_lib.h"
+#include "globals.h"
 #include "ncrypt.h"
 #include "options.h"
 #ifdef USE_AUTOCRYPT
@@ -200,13 +201,16 @@ int crypt_pgp_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Bo
 #ifdef USE_AUTOCRYPT
   int result;
 
-  OptAutocryptGpgme = true;
-  result = pgp_gpgme_decrypt_mime(fp_in, fp_out, b, cur);
-  OptAutocryptGpgme = false;
-  if (result == 0)
+  if (C_Autocrypt)
   {
-    b->is_autocrypt = 1;
-    return result;
+    OptAutocryptGpgme = true;
+    result = pgp_gpgme_decrypt_mime(fp_in, fp_out, b, cur);
+    OptAutocryptGpgme = false;
+    if (result == 0)
+    {
+      b->is_autocrypt = 1;
+      return result;
+    }
   }
 #endif
 
@@ -239,13 +243,16 @@ int crypt_pgp_encrypted_handler(struct Body *a, struct State *s)
 #ifdef USE_AUTOCRYPT
   int result;
 
-  OptAutocryptGpgme = true;
-  result = pgp_gpgme_encrypted_handler(a, s);
-  OptAutocryptGpgme = false;
-  if (result == 0)
+  if (C_Autocrypt)
   {
-    a->is_autocrypt = 1;
-    return result;
+    OptAutocryptGpgme = true;
+    result = pgp_gpgme_encrypted_handler(a, s);
+    OptAutocryptGpgme = false;
+    if (result == 0)
+    {
+      a->is_autocrypt = 1;
+      return result;
+    }
   }
 #endif