changeset: 7084:26cbf2cac701
user:      Kevin McCarthy <ke...@8t8.us>
date:      Mon Jun 12 17:57:05 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/26cbf2cac701

Make GPGME key selection behavior the same as classic-PGP. (see #3950)

Classic-PGP key selection auto-selected a match if there was a single
strong, valid, address-match result, even if there were other weak
matches.

GPGME was prompting in the same situation, if there were other weak
matches.

Change GPGME to match the classic behavior, as this is more useful and
matches the manual description.

diffs (82 lines):

diff -r dd0208f13983 -r 26cbf2cac701 crypt-gpgme.c
--- a/crypt-gpgme.c     Fri Jun 09 11:31:06 2017 -0700
+++ b/crypt-gpgme.c     Mon Jun 12 17:57:05 2017 -0700
@@ -4154,14 +4154,9 @@
   ADDRESS *r, *p;
   LIST *hints = NULL;
 
-  int weak    = 0;
-  int invalid = 0;
-  int addr_match = 0;
   int multi   = 0;
   int this_key_has_strong;
   int this_key_has_addr_match;
-  int this_key_has_weak;
-  int this_key_has_invalid;
   int match;
 
   crypt_key_t *keys, *k;
@@ -4201,8 +4196,6 @@
           continue;
         }
 
-      this_key_has_weak    = 0;        /* weak but valid match   */
-      this_key_has_invalid = 0;   /* invalid match          */
       this_key_has_strong  = 0;        /* strong and valid match */
       this_key_has_addr_match = 0;
       match                = 0;   /* any match                   */
@@ -4216,9 +4209,8 @@
           {
             match = 1;
 
-            if (validity & CRYPT_KV_VALID)
-            {
-              if (validity & CRYPT_KV_ADDR)
+            if ((validity & CRYPT_KV_VALID) &&
+                (validity & CRYPT_KV_ADDR))
               {
                 if (validity & CRYPT_KV_STRONGID)
                 {
@@ -4230,11 +4222,6 @@
                 else
                   this_key_has_addr_match = 1;
               }
-              else
-                this_key_has_weak = 1;
-            }
-            else
-              this_key_has_invalid = 1;
           }
         }
       rfc822_free_address (&r);
@@ -4249,14 +4236,7 @@
           if (this_key_has_strong)
             the_strong_valid_key = tmp;
           else if (this_key_has_addr_match)
-          {
-            addr_match = 1;
             a_valid_addrmatch_key = tmp;
-          }
-          else if (this_key_has_invalid)
-            invalid = 1;
-          else if (this_key_has_weak)
-            weak = 1;
         }
     }
   
@@ -4273,13 +4253,10 @@
           else
             k = NULL;
         }
-      else if (the_strong_valid_key && !multi && !weak && !addr_match
-          && !(invalid && option (OPTPGPSHOWUNUSABLE)))
+      else if (the_strong_valid_key && !multi)
         {      
           /* 
-           * There was precisely one strong match on a valid ID, there
-           * were no valid keys with weak matches, and we aren't
-           * interested in seeing invalid keys.
+           * There was precisely one strong match on a valid ID.
            * 
            * Proceed without asking the user.
            */

Reply via email to