]> granicus.if.org Git - neomutt/commitdiff
Fix process_gossip_headers() to look at the right envelope
authorKevin McCarthy <kevin@8t8.us>
Thu, 25 Jul 2019 01:59:07 +0000 (18:59 -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>
autocrypt/autocrypt.c
autocrypt/autocrypt.h
commands.c

index 9aab282bb06a8c3b9b16d84fae6aeb0388580b38..500bb706a60bb38b9a9bd0f2181eb32d0978ff58 100644 (file)
@@ -311,8 +311,9 @@ cleanup:
   return rv;
 }
 
-int mutt_autocrypt_process_gossip_header(struct Email *hdr, struct Envelope *env)
+int mutt_autocrypt_process_gossip_header(struct Email *hdr, struct Envelope *prot_headers)
 {
+  struct Envelope *env;
   struct AutocryptHeader *ac_hdr;
   struct timeval now;
   struct AutocryptPeer *peer = NULL;
@@ -329,9 +330,11 @@ int mutt_autocrypt_process_gossip_header(struct Email *hdr, struct Envelope *env
   if (mutt_autocrypt_init(0))
     return -1;
 
-  if (!hdr || !hdr->content || !env)
+  if (!hdr || !hdr->env || !prot_headers)
     return 0;
 
+  env = hdr->env;
+
   struct Address *from = TAILQ_FIRST(&env->from);
   if (!from)
     return 0;
@@ -352,7 +355,7 @@ int mutt_autocrypt_process_gossip_header(struct Email *hdr, struct Envelope *env
   mutt_addrlist_copy(&recips, &env->reply_to, false);
   mutt_autocrypt_db_normalize_addrlist(&recips);
 
-  for (ac_hdr = env->autocrypt_gossip; ac_hdr; ac_hdr = ac_hdr->next)
+  for (ac_hdr = prot_headers->autocrypt_gossip; ac_hdr; ac_hdr = ac_hdr->next)
   {
     if (ac_hdr->invalid)
       continue;
index 95a77305abc89b8b76f8965232a2bb70e0be0967..6ca8a347af88efdd1f37a8b8970c99d83e616a2c 100644 (file)
@@ -79,7 +79,7 @@ enum AutocryptRec
 int mutt_autocrypt_init (int);
 void mutt_autocrypt_cleanup (void);
 int mutt_autocrypt_process_autocrypt_header (struct Email *hdr, struct Envelope *env);
-int mutt_autocrypt_process_gossip_header (struct Email *hdr, struct Envelope *env);
+int mutt_autocrypt_process_gossip_header (struct Email *hdr, struct Envelope *prot_headers);
 enum AutocryptRec mutt_autocrypt_ui_recommendation (struct Email *hdr, char **keylist);
 int mutt_autocrypt_set_sign_as_default_key (struct Email *hdr);
 int mutt_autocrypt_write_autocrypt_header (struct Envelope *env, FILE *fp);
index 2d369c866499053805c274a27908349f13842b88..69db23fb13585a8f51f96fbc36b0f20a220cfc16 100644 (file)
@@ -181,7 +181,7 @@ static void process_protected_headers(struct Email *e)
 #ifdef USE_AUTOCRYPT
   if (C_Autocrypt && (e->security & SEC_ENCRYPT) && prot_headers && prot_headers->autocrypt_gossip)
   {
-    mutt_autocrypt_process_gossip_header(e, e->env);
+    mutt_autocrypt_process_gossip_header(e, prot_headers);
   }
 #endif
 }