[Pkg-gnupg-commit] [gnupg2] 01/02: fix searches for keys with raw addr-spec

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Jan 25 22:01:08 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit 2f03f6aa3e334aa5d66a021ca98870ec7e1692fb
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Wed Jan 25 14:38:12 2017 -0500

    fix searches for keys with raw addr-spec
---
 ...-searching-for-mail-addresses-in-keyrings.patch | 54 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 55 insertions(+)

diff --git a/debian/patches/0018-gpg-Fix-searching-for-mail-addresses-in-keyrings.patch b/debian/patches/0018-gpg-Fix-searching-for-mail-addresses-in-keyrings.patch
new file mode 100644
index 0000000..6365109
--- /dev/null
+++ b/debian/patches/0018-gpg-Fix-searching-for-mail-addresses-in-keyrings.patch
@@ -0,0 +1,54 @@
+From: Justus Winter <justus at g10code.com>
+Date: Wed, 25 Jan 2017 16:33:20 +0100
+Subject: gpg: Fix searching for mail addresses in keyrings.
+
+* g10/keyring.c (compare_name): Fix KEYDB_SEARCH_MODE_MAIL* searches
+in keyrings when the UID is a plain addr-spec.
+--
+Previously, 'gpg --list-key "<foo at example.org>"' failed if 1/ the
+keyring format is used and 2/ the key's UID is a plain addr-spec
+(cf. RFC2822 section 4.3), e.g. 'foo at example.org'.
+
+GnuPG-bug-id: 2930
+Signed-off-by: Justus Winter <justus at g10code.com>
+(cherry picked from commit 3f4f20ee6eff052c88647b820d9ecfdbd8df0f40)
+---
+ g10/keyring.c | 22 ++++++++++++++++++----
+ 1 file changed, 18 insertions(+), 4 deletions(-)
+
+diff --git a/g10/keyring.c b/g10/keyring.c
+index f1281e98e..328290ed8 100644
+--- a/g10/keyring.c
++++ b/g10/keyring.c
+@@ -928,13 +928,27 @@ compare_name (int mode, const char *name, const char *uid, size_t uidlen)
+     else if (   mode == KEYDB_SEARCH_MODE_MAIL
+              || mode == KEYDB_SEARCH_MODE_MAILSUB
+              || mode == KEYDB_SEARCH_MODE_MAILEND) {
++        int have_angles = 1;
+ 	for (i=0, s= uid; i < uidlen && *s != '<'; s++, i++)
+ 	    ;
++	if (i == uidlen)
++	  {
++	    /* The UID is a plain addr-spec (cf. RFC2822 section 4.3).  */
++	    have_angles = 0;
++	    s = uid;
++	    i = 0;
++	  }
+ 	if (i < uidlen)  {
+-	    /* skip opening delim and one char and look for the closing one*/
+-	    s++; i++;
+-	    for (se=s+1, i++; i < uidlen && *se != '>'; se++, i++)
+-		;
++	    if (have_angles)
++	      {
++		/* skip opening delim and one char and look for the closing one*/
++		s++; i++;
++		for (se=s+1, i++; i < uidlen && *se != '>'; se++, i++)
++		  ;
++	      }
++	    else
++	      se = s + uidlen;
++
+ 	    if (i < uidlen) {
+ 		i = se - s;
+ 		if (mode == KEYDB_SEARCH_MODE_MAIL) {
diff --git a/debian/patches/series b/debian/patches/series
index 8ab8f62..b3974e4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -15,3 +15,4 @@ gpg-agent-idling/0004-agent-Avoid-scheduled-checks-on-socket-when-inotify-.patch
 0015-dirmngr-Simplify-error-returning-inside-http.c.patch
 0016-gpg-Print-a-warning-on-Tor-problems.patch
 0017-agent-Fix-double-free.patch
+0018-gpg-Fix-searching-for-mail-addresses-in-keyrings.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list