[svn] GnuPG - r4138 - trunk/g10

svn author dshaw cvs at cvs.gnupg.org
Mon May 22 18:53:13 CEST 2006


Author: dshaw
Date: 2006-05-22 18:53:09 +0200 (Mon, 22 May 2006)
New Revision: 4138

Modified:
   trunk/g10/ChangeLog
   trunk/g10/getkey.c
   trunk/g10/import.c
Log:
* getkey.c (get_pubkey_byname), import.c (import_one): Fix key selection
problem when auto-key-locate returns a list of keys, not all of which are
usable (revoked, expired, etc).  Noted by Simon Josefsson.


Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2006-05-22 14:35:04 UTC (rev 4137)
+++ trunk/g10/ChangeLog	2006-05-22 16:53:09 UTC (rev 4138)
@@ -1,3 +1,10 @@
+2006-05-22  David Shaw  <dshaw at jabberwocky.com>
+
+	* getkey.c (get_pubkey_byname), import.c (import_one): Fix key
+	selection problem when auto-key-locate returns a list of keys, not
+	all of which are usable (revoked, expired, etc).  Noted by Simon
+	Josefsson.
+
 2006-04-26  David Shaw  <dshaw at jabberwocky.com>
 
 	* keyserver.c (direct_uri_map): New.

Modified: trunk/g10/getkey.c
===================================================================
--- trunk/g10/getkey.c	2006-05-22 14:35:04 UTC (rev 4137)
+++ trunk/g10/getkey.c	2006-05-22 16:53:09 UTC (rev 4138)
@@ -934,7 +934,7 @@
 
       for(akl=opt.auto_key_locate;akl;akl=akl->next)
 	{
-	  unsigned char *fpr;
+	  unsigned char *fpr=NULL;
 	  size_t fpr_len;
 
 	  switch(akl->type)

Modified: trunk/g10/import.c
===================================================================
--- trunk/g10/import.c	2006-05-22 14:35:04 UTC (rev 4137)
+++ trunk/g10/import.c	2006-05-22 16:53:09 UTC (rev 4138)
@@ -696,9 +696,6 @@
 
     pk = node->pkt->pkt.public_key;
 
-    if(fpr)
-      *fpr=fingerprint_from_pk(pk,NULL,fpr_len);
-
     keyid_from_pk( pk, keyid );
     uidnode = find_next_kbnode( keyblock, PKT_USER_ID );
 
@@ -981,6 +978,17 @@
       }
     else if(new_key)
       {
+	if(fpr && stats->imported==1)
+	  {
+	    xfree(*fpr);
+	    *fpr=fingerprint_from_pk(pk,NULL,fpr_len);
+	  }
+	else
+	  {
+	    xfree(*fpr);
+	    *fpr=NULL;
+	  }
+
 	revocation_present(keyblock);
 	if(seckey_available(keyid)==0)
 	  check_prefs(keyblock);




More information about the Gnupg-commits mailing list