Your message dated Thu, 28 Jan 2010 23:46:29 -0500
with message-id <[email protected]>
has caused the   report #566341,
regarding gnupg handler prompts for choice between two identical gpg keys
to be marked as having been forwarded to the upstream software
author(s) Markus Braun <[email protected]>

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
566341: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=566341
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
tag 566341 patch
thanks

Markus,

When a user has gpg setup such that it searches multiple keyrings, they
may be told that the recipient they specified was ambiguous when it
actually wasn't.  This happens when the recipient has a key present in
more than one of the keyrings in-use.

Attached patch changes GPGNameToID to ignore duplicate lines from gpg in
order to avoid this problem.

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
From 90befc3f5acebfb2b58aa951d68da8f17a131d8d Mon Sep 17 00:00:00 2001
From: James Vega <[email protected]>
Date: Thu, 28 Jan 2010 23:30:30 -0500
Subject: [PATCH 2/3] Ignore duplicate lines from gnupg.

This can happen in the case that the user's gpg.conf specifies to use another
keyring in addition to their own.  If both keyrings contain the same key, the
user would be unnecessarily prompted to choose from "ambiguous" names.

Signed-off-by: James Vega <[email protected]>
---
 plugin/gnupg.vim |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim
index fdbbfc0..1746722 100644
--- a/plugin/gnupg.vim
+++ b/plugin/gnupg.vim
@@ -1051,8 +1051,16 @@ function s:GPGNameToID(name)
   let pubseen = 0
   let counter = 0
   let gpgids = []
+  let duplicates = {}
   let choices = "The name \"" . a:name . "\" is ambiguous. Please select the correct key:\n"
   for line in lines
+    if !has_key(duplicates, line)
+      let duplicates[line] = 1
+    else
+      " Exact line has already been seen.  Probably multiple keyrings being
+      " searched with the same data.
+      continue
+    endif
     let fields = split(line, ":")
     " search for the next uid
     if (pubseen == 1)
@@ -1090,7 +1098,7 @@ function s:GPGNameToID(name)
     endwhile
   endif
 
-  call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGIDToName()")
+  call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGNameToID()")
   return get(gpgids, answer, "")
 endfunction
 
-- 
1.6.6

Attachment: signature.asc
Description: Digital signature


--- End Message ---

Reply via email to