]> granicus.if.org Git - neomutt/commitdiff
Slightly improve the gossip header key update
authorKevin McCarthy <kevin@8t8.us>
Fri, 26 Jul 2019 02:12:32 +0000 (19:12 -0700)
committerRichard Russon <rich@flatcap.org>
Mon, 19 Aug 2019 23:14:27 +0000 (00:14 +0100)
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 <rich@flatcap.org>
autocrypt/autocrypt.c

index 500bb706a60bb38b9a9bd0f2181eb32d0978ff58..276e53e64bc343d4dc98af52d00ad04f88b1947d 100644 (file)
@@ -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;