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-Tag: 2019-10-25~97^2~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c83c11d7e8d3a2ec0f52fe40818a7faaa3ef52f;p=neomutt Fix process_gossip_headers() to look at the right envelope Co-authored-by: Richard Russon --- diff --git a/autocrypt/autocrypt.c b/autocrypt/autocrypt.c index 9aab282bb..500bb706a 100644 --- a/autocrypt/autocrypt.c +++ b/autocrypt/autocrypt.c @@ -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; diff --git a/autocrypt/autocrypt.h b/autocrypt/autocrypt.h index 95a77305a..6ca8a347a 100644 --- a/autocrypt/autocrypt.h +++ b/autocrypt/autocrypt.h @@ -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); diff --git a/commands.c b/commands.c index 2d369c866..69db23fb1 100644 --- a/commands.c +++ b/commands.c @@ -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 }