]> granicus.if.org Git - neomutt/commitdiff
Add account->enabled checks
authorKevin McCarthy <kevin@8t8.us>
Sat, 27 Jul 2019 22:34:51 +0000 (15:34 -0700)
committerRichard Russon <rich@flatcap.org>
Mon, 19 Aug 2019 23:14:27 +0000 (00:14 +0100)
Add to ui recommendation, keylist generator, and autocrypt header
writing routines.

Co-authored-by: Richard Russon <rich@flatcap.org>
autocrypt/autocrypt.c

index 5ccbf113097622f373f2a5e6e1a466d82bd8e143..3bebe9274f9cfb16c17404d30438b4610ad702d1 100644 (file)
@@ -510,6 +510,9 @@ enum AutocryptRec mutt_autocrypt_ui_recommendation(struct Email *hdr, char **key
   if (mutt_autocrypt_db_account_get(from, &account) <= 0)
     goto cleanup;
 
+  if (!account->enabled)
+    goto cleanup;
+
   keylist_buf = mutt_buffer_pool_get();
   mutt_buffer_addstr(keylist_buf, account->keyid);
 
@@ -606,6 +609,8 @@ int mutt_autocrypt_set_sign_as_default_key(struct Email *hdr)
     goto cleanup;
   if (!account->keyid)
     goto cleanup;
+  if (!account->enabled)
+    goto cleanup;
 
   mutt_str_replace(&AutocryptSignAs, account->keyid);
   mutt_str_replace(&AutocryptDefaultKey, account->keyid);
@@ -657,6 +662,8 @@ int mutt_autocrypt_write_autocrypt_header(struct Envelope *env, FILE *fp)
     goto cleanup;
   if (!account->keydata)
     goto cleanup;
+  if (!account->enabled)
+    goto cleanup;
 
   fputs("Autocrypt: ", fp);
   write_autocrypt_header_line(fp, account->email_addr, account->prefer_encrypt,