[git] GnuPG - branch, master, updated. gnupg-2.1.9-205-g10cca02

by Neal H. Walfield cvs at cvs.gnupg.org
Wed Dec 2 12:03:40 CET 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  10cca02c4c70eee993d4df0a1d20ae841992efe9 (commit)
      from  9c34711539fc2c34aea8da0fd49ae6aa28991518 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 10cca02c4c70eee993d4df0a1d20ae841992efe9
Author: Neal H. Walfield <neal at g10code.com>
Date:   Wed Dec 2 11:07:05 2015 +0100

    common,gpg: Fix processing of search descriptions ending in '!'.
    
    * g10/gpg.c (check_user_ids): If the search description describes a
    keyid or fingerprint and ends in a '!', include the '!' in the
    rewritten description.
    * common/userids.c (classify_user_id): Accept keyids and fingerprints
    ending in '!'.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>
    Reported-by: Kristian Fiskerstrand
      <kristian.fiskerstrand at sumptuouscapital.com>
    Fixes-commit: f99830b7
    Fixes-commit: e8c53fca

diff --git a/common/userids.c b/common/userids.c
index f9a0036..e094c69 100644
--- a/common/userids.c
+++ b/common/userids.c
@@ -282,7 +282,9 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
       if (desc->exact)
         hexlength--; /* Remove the bang.  */
 
-      if ((hexlength == 8 && s[hexlength] == 0)
+      if ((hexlength == 8
+           && (s[hexlength] == 0
+               || (s[hexlength] == '!' && s[hexlength + 1] == 0)))
           || (!hexprefix && hexlength == 9 && *s == '0'))
         {
           /* Short keyid.  */
@@ -291,7 +293,9 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
           desc->u.kid[1] = strtoul( s, NULL, 16 );
           mode = KEYDB_SEARCH_MODE_SHORT_KID;
         }
-      else if ((hexlength == 16 && s[hexlength] == 0)
+      else if ((hexlength == 16
+                && (s[hexlength] == 0
+                    || (s[hexlength] == '!' && s[hexlength + 1] == 0)))
                || (!hexprefix && hexlength == 17 && *s == '0'))
         {
           /* Long keyid.  */
@@ -303,7 +307,9 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
           desc->u.kid[1] = strtoul (s+8, NULL, 16);
           mode = KEYDB_SEARCH_MODE_LONG_KID;
         }
-      else if ((hexlength == 32 && s[hexlength] == 0)
+      else if ((hexlength == 32
+                && (s[hexlength] == 0
+                    || (s[hexlength] == '!' && s[hexlength + 1] == 0)))
                || (!hexprefix && hexlength == 33 && *s == '0'))
         {
           /* MD5 fingerprint.  */
@@ -323,7 +329,9 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
             }
           mode = KEYDB_SEARCH_MODE_FPR16;
         }
-      else if ((hexlength == 40 && s[hexlength] == 0)
+      else if ((hexlength == 40
+                && (s[hexlength] == 0
+                    || (s[hexlength] == '!' && s[hexlength + 1] == 0)))
                || (!hexprefix && hexlength == 41 && *s == '0'))
         {
           /* SHA1/RMD160 fingerprint.  */
diff --git a/g10/gpg.c b/g10/gpg.c
index 5c5afa6..5aeb94d 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -2109,7 +2109,8 @@ check_user_ids (strlist_t *sp,
       PKT_public_key *pk;
       char fingerprint_bin[MAX_FINGERPRINT_LEN];
       size_t fingerprint_bin_len = sizeof (fingerprint_bin);
-      char fingerprint[2 * MAX_FINGERPRINT_LEN + 1];
+      /* We also potentially need a ! at the end.  */
+      char fingerprint[2 * MAX_FINGERPRINT_LEN + 1 + 1];
 
 
       switch (t->flags >> 2)
@@ -2198,6 +2199,17 @@ check_user_ids (strlist_t *sp,
       fingerprint_from_pk (pk, fingerprint_bin, &fingerprint_bin_len);
       assert (fingerprint_bin_len == sizeof (fingerprint_bin));
       bin2hex (fingerprint_bin, MAX_FINGERPRINT_LEN, fingerprint);
+      if ((desc.mode == KEYDB_SEARCH_MODE_SHORT_KID
+           || desc.mode == KEYDB_SEARCH_MODE_LONG_KID
+           || desc.mode == KEYDB_SEARCH_MODE_FPR16
+           || desc.mode == KEYDB_SEARCH_MODE_FPR20)
+          && strchr (t->d, '!'))
+        {
+          int i = strlen (fingerprint);
+          fingerprint[i] = '!';
+          fingerprint[i + 1] = '\0';
+        }
+
       add_to_strlist (&s2, fingerprint);
       s2->flags = s->flags;
 

-----------------------------------------------------------------------

Summary of changes:
 common/userids.c | 16 ++++++++++++----
 g10/gpg.c        | 14 +++++++++++++-
 2 files changed, 25 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list