From: Kevin McCarthy Date: Thu, 25 Jul 2019 01:59:07 +0000 (-0700) Subject: Fix process_gossip_headers() to look at the right envelope. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=78d028d78112463c522b3447008fecb9bc1242fe;p=mutt Fix process_gossip_headers() to look at the right envelope. --- diff --git a/autocrypt/autocrypt.c b/autocrypt/autocrypt.c index 7ac2bd5f..d56d70ea 100644 --- a/autocrypt/autocrypt.c +++ b/autocrypt/autocrypt.c @@ -305,8 +305,9 @@ cleanup: return rv; } -int mutt_autocrypt_process_gossip_header (HEADER *hdr, ENVELOPE *env) +int mutt_autocrypt_process_gossip_header (HEADER *hdr, ENVELOPE *prot_headers) { + ENVELOPE *env; AUTOCRYPTHDR *ac_hdr; struct timeval now; AUTOCRYPT_PEER *peer = NULL; @@ -322,9 +323,11 @@ int mutt_autocrypt_process_gossip_header (HEADER *hdr, 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; + if (!env->from) return 0; @@ -342,7 +345,7 @@ int mutt_autocrypt_process_gossip_header (HEADER *hdr, ENVELOPE *env) rfc822_append (last ? &last : &recips, env->reply_to, 0); 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; diff --git a/autocrypt/autocrypt.h b/autocrypt/autocrypt.h index 83c5f7c8..78779777 100644 --- a/autocrypt/autocrypt.h +++ b/autocrypt/autocrypt.h @@ -74,7 +74,7 @@ typedef enum int mutt_autocrypt_init (int); void mutt_autocrypt_cleanup (void); int mutt_autocrypt_process_autocrypt_header (HEADER *hdr, ENVELOPE *env); -int mutt_autocrypt_process_gossip_header (HEADER *hdr, ENVELOPE *env); +int mutt_autocrypt_process_gossip_header (HEADER *hdr, ENVELOPE *prot_headers); autocrypt_rec_t mutt_autocrypt_ui_recommendation (HEADER *hdr, char **keylist); int mutt_autocrypt_set_sign_as_default_key (HEADER *hdr); int mutt_autocrypt_write_autocrypt_header (ENVELOPE *env, FILE *fp); diff --git a/commands.c b/commands.c index 902e3f2a..7e503a29 100644 --- a/commands.c +++ b/commands.c @@ -147,7 +147,7 @@ static void process_protected_headers (HEADER *cur) prot_headers && prot_headers->autocrypt_gossip) { - mutt_autocrypt_process_gossip_header (cur, cur->env); + mutt_autocrypt_process_gossip_header (cur, prot_headers); } #endif }