[svn] GnuPG - r3919 - trunk/g10

svn author dshaw cvs at cvs.gnupg.org
Wed Nov 2 06:22:02 CET 2005


Author: dshaw
Date: 2005-11-02 06:22:01 +0100 (Wed, 02 Nov 2005)
New Revision: 3919

Modified:
   trunk/g10/ChangeLog
   trunk/g10/export.c
   trunk/g10/import.c
   trunk/g10/trustdb.c
Log:
* import.c (import_one): Do collapse_uids() before we do any cleaning
so keyserver mangled keys with doubled user IDs can be properly
cleaned - possibly sigs on the different user IDs cancel each other
out.

* import.c (parse_import_options), export.c (parse_export_options):
List "xxx-clean" before the longer options so we don't end up with a
partial match on the longer options.

* trustdb.c (clean_uids_from_key): Return proper number of cleaned
user IDs.  Don't count user IDs as cleaned unless we actually delete
something.


Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2005-10-27 19:18:05 UTC (rev 3918)
+++ trunk/g10/ChangeLog	2005-11-02 05:22:01 UTC (rev 3919)
@@ -1,3 +1,18 @@
+2005-11-01  David Shaw  <dshaw at jabberwocky.com>
+
+	* import.c (import_one): Do collapse_uids() before we do any
+	cleaning so keyserver mangled keys with doubled user IDs can be
+	properly cleaned - possibly sigs on the different user IDs cancel
+	each other out.
+
+	* import.c (parse_import_options), export.c
+	(parse_export_options): List "xxx-clean" before the longer options
+	so we don't end up with a partial match on the longer options.
+
+	* trustdb.c (clean_uids_from_key): Return proper number of cleaned
+	user IDs.  Don't count user IDs as cleaned unless we actually
+	delete something.
+
 2005-10-27  David Shaw  <dshaw at jabberwocky.com>
 
 	* keyedit.c (menu_addrevoker), getkey.c (finish_lookup): Fix

Modified: trunk/g10/export.c
===================================================================
--- trunk/g10/export.c	2005-10-27 19:18:05 UTC (rev 3918)
+++ trunk/g10/export.c	2005-11-02 05:22:01 UTC (rev 3919)
@@ -64,12 +64,12 @@
        N_("export attribute user IDs (generally photo IDs)")},
       {"export-sensitive-revkeys",EXPORT_SENSITIVE_REVKEYS,NULL,
        N_("export revocation keys that are marked as \"sensitive\"")},
+      {"export-clean",EXPORT_CLEAN_SIGS|EXPORT_CLEAN_UIDS,NULL,
+       N_("all export-clean-* options from above")},
       {"export-clean-sigs",EXPORT_CLEAN_SIGS,NULL,
        N_("remove unusable signatures during export")},
       {"export-clean-uids",EXPORT_CLEAN_UIDS,NULL,
        N_("remove unusable user IDs during export")},
-      {"export-clean",EXPORT_CLEAN_SIGS|EXPORT_CLEAN_UIDS,NULL,
-       N_("all export-clean-* options from above")},
       {"export-minimal",
        EXPORT_MINIMAL|EXPORT_CLEAN_SIGS|EXPORT_CLEAN_UIDS,NULL,
        N_("export the smallest key possible")},

Modified: trunk/g10/import.c
===================================================================
--- trunk/g10/import.c	2005-10-27 19:18:05 UTC (rev 3918)
+++ trunk/g10/import.c	2005-11-02 05:22:01 UTC (rev 3919)
@@ -101,12 +101,12 @@
        N_("create a public key when importing a secret key")},
       {"merge-only",IMPORT_MERGE_ONLY,NULL,
        N_("only accept updates to existing keys")},
+      {"import-clean",IMPORT_CLEAN_SIGS|IMPORT_CLEAN_UIDS,NULL,
+       N_("all import-clean-* options from above")},
       {"import-clean-sigs",IMPORT_CLEAN_SIGS,NULL,
        N_("remove unusable signatures after import")},
       {"import-clean-uids",IMPORT_CLEAN_UIDS,NULL,
        N_("remove unusable user IDs after import")},
-      {"import-clean",IMPORT_CLEAN_SIGS|IMPORT_CLEAN_UIDS,NULL,
-       N_("all import-clean-* options from above")},
       /* Aliases for backward compatibility */
       {"allow-local-sigs",IMPORT_LOCAL_SIGS,NULL,NULL},
       {"repair-hkp-subkey-bug",IMPORT_REPAIR_PKS_SUBKEY_BUG,NULL,NULL},
@@ -739,6 +739,8 @@
             return 0;
     }
 
+    collapse_uids(&keyblock);
+
     /* Clean the key that we're about to import, to cut down on things
        that we have to clean later.  This has no practical impact on
        the end result, but does result in less logging which might
@@ -808,8 +810,6 @@
 	if( opt.verbose > 1 )
 	    log_info (_("writing to `%s'\n"), keydb_get_resource_name (hd) );
 
-	collapse_uids(&keyblock);
-
 	rc = keydb_insert_keyblock (hd, keyblock );
         if (rc)
 	   log_error (_("error writing keyring `%s': %s\n"),
@@ -886,7 +886,6 @@
 	    goto leave;
 	  }
 
-	collapse_uids( &keyblock );
 	/* and try to merge the block */
 	clear_kbnode_flags( keyblock_orig );
 	clear_kbnode_flags( keyblock );

Modified: trunk/g10/trustdb.c
===================================================================
--- trunk/g10/trustdb.c	2005-10-27 19:18:05 UTC (rev 3918)
+++ trunk/g10/trustdb.c	2005-11-02 05:22:01 UTC (rev 3919)
@@ -1654,7 +1654,7 @@
 int
 clean_uids_from_key(KBNODE keyblock,int noisy)
 {
-  int delete_until_next=0,deleted=0;
+  int delete_until_next=0,deleting=0,deleted=0;
   KBNODE node,signode=NULL;
   u32 keyid[2],sigdate=0;
 
@@ -1684,6 +1684,7 @@
 	  else
 	    {
 	      delete_until_next=1;
+	      deleting=1;
 
 	      if(noisy)
 		{
@@ -1722,7 +1723,11 @@
 	  if(delete_until_next && !sig->flags.chosen_selfsig)
 	    {
 	      delete_kbnode(node);
-	      deleted++;
+	      if(deleting)
+		{
+		  deleted++;
+		  deleting=0;
+		}
 	    }
 	}
     }




More information about the Gnupg-commits mailing list