From bf72171b5810d0a51daf4fe7267b2d2a3df97b00 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Thu, 25 Jul 2019 19:12:32 -0700 Subject: [PATCH] Slightly improve the gossip header key update Don't set an empty peer.gossip_keydata with a value that matches the current peer.keydata. This just wastes space. Co-authored-by: Richard Russon --- autocrypt/autocrypt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autocrypt/autocrypt.c b/autocrypt/autocrypt.c index 500bb706a..276e53e64 100644 --- a/autocrypt/autocrypt.c +++ b/autocrypt/autocrypt.c @@ -390,7 +390,11 @@ int mutt_autocrypt_process_gossip_header(struct Email *hdr, struct Envelope *pro update_db = 1; peer->gossip_timestamp = hdr->date_sent; - if (mutt_str_strcmp(peer->gossip_keydata, ac_hdr->keydata)) + /* This is slightly different from the autocrypt 1.1 spec. + * Avoid setting an empty peer.gossip_keydata with a value that matches + * the current peer.keydata. */ + if ((peer->gossip_keydata && mutt_str_strcmp(peer->gossip_keydata, ac_hdr->keydata)) || + (!peer->gossip_keydata && mutt_str_strcmp(peer->keydata, ac_hdr->keydata))) { import_gpg = 1; insert_db_history = 1; -- 2.50.1