[svn] gpgme - r1296 - trunk/gpgme

svn author wk cvs at cvs.gnupg.org
Mon Jan 28 19:46:10 CET 2008


Author: wk
Date: 2008-01-28 19:46:08 +0100 (Mon, 28 Jan 2008)
New Revision: 1296

Modified:
   trunk/gpgme/ChangeLog
   trunk/gpgme/gpgme.h
   trunk/gpgme/keylist.c
Log:
Fixed bug 876


Modified: trunk/gpgme/ChangeLog
===================================================================
--- trunk/gpgme/ChangeLog	2008-01-14 17:34:21 UTC (rev 1295)
+++ trunk/gpgme/ChangeLog	2008-01-28 18:46:08 UTC (rev 1296)
@@ -1,3 +1,7 @@
+2008-01-28  Werner Koch  <wk at g10code.com>
+
+	* keylist.c (gpgme_get_key): Skip duplicated keys.  Fixes bug 876.
+
 2008-01-14  Marcus Brinkmann  <marcus at g10code.de>
 
 	* engine-gpgconf.c (gpgconf_config_load_cb): Fix program_name

Modified: trunk/gpgme/gpgme.h
===================================================================
--- trunk/gpgme/gpgme.h	2008-01-14 17:34:21 UTC (rev 1295)
+++ trunk/gpgme/gpgme.h	2008-01-28 18:46:08 UTC (rev 1296)
@@ -72,7 +72,7 @@
    AM_PATH_GPGME macro) check that this header matches the installed
    library.  Warning: Do not edit the next line.  configure will do
    that for you!  */
-#define GPGME_VERSION "1.1.6-svn1282"
+#define GPGME_VERSION "1.1.7-svn1295"
 
 
 

Modified: trunk/gpgme/keylist.c
===================================================================
--- trunk/gpgme/keylist.c	2008-01-14 17:34:21 UTC (rev 1295)
+++ trunk/gpgme/keylist.c	2008-01-28 18:46:08 UTC (rev 1296)
@@ -1,6 +1,7 @@
 /* keylist.c - Listing keys.
    Copyright (C) 2000 Werner Koch (dd9jn)
-   Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 g10 Code GmbH
+   Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007,
+                 2008  g10 Code GmbH
 
    This file is part of GPGME.
  
@@ -15,9 +16,8 @@
    Lesser General Public License for more details.
    
    You should have received a copy of the GNU Lesser General Public
-   License along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
 
 #if HAVE_CONFIG_H
 #include <config.h>
@@ -964,11 +964,26 @@
     err = gpgme_op_keylist_next (listctx, r_key);
   if (!err)
     {
+    try_next_key:
       err = gpgme_op_keylist_next (listctx, &key);
       if (gpgme_err_code (err) == GPG_ERR_EOF)
-	err = gpg_error (GPG_ERR_NO_ERROR);
+	err = 0;
       else
 	{
+          if (!err
+              && *r_key && (*r_key)->subkeys && (*r_key)->subkeys->fpr
+              && key && key->subkeys && key->subkeys->fpr
+              && !strcmp ((*r_key)->subkeys->fpr, key->subkeys->fpr))
+            {
+              /* The fingerprint is identical.  We assume that this is
+                 the same key and don't mark it as an ambiguous.  This
+                 problem may occur with corrupted keyrings and has
+                 been noticed often with gpgsm.  In fact gpgsm uses a
+                 similar hack to sort out such duplicates but it can't
+                 do that while listing keys.  */
+              gpgme_key_unref (key);
+              goto try_next_key;
+            }
 	  if (!err)
 	    {
 	      gpgme_key_unref (key);




More information about the Gnupg-commits mailing list