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 <james...@debian.org>
From 90befc3f5acebfb2b58aa951d68da8f17a131d8d Mon Sep 17 00:00:00 2001 From: James Vega <james...@debian.org> 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 <james...@debian.org> --- 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
signature.asc
Description: Digital signature