gnupg/g10 (ChangeLog import.c keyserver.c trustdb.c trustdb.h)

cvs user dshaw cvs at cvs.gnupg.org
Sun Feb 6 18:29:07 CET 2005


    Date: Sunday, February 6, 2005 @ 18:38:43
  Author: dshaw
    Path: /cvs/gnupg/gnupg/g10

Modified: ChangeLog import.c keyserver.c trustdb.c trustdb.h

* trustdb.h, trustdb.c (trustdb_check_or_update): New.  If the trustdb
is dirty and --interactive is set, do an --update-trustdb.  If not
interactive, do a --check_trustdb unless --no-auto-check-trustdb is
set.

* import.c (import_keys_internal): Moved from here.

* keyserver.c (keyserver_refresh): Call it here after all refreshing
has happened so that we don't rebuild after each preferred keyserver
set of imports, but do one big rebuild at the end.  This is Debian bug
#293816, noted by Kurt Roeckx.


-------------+
 ChangeLog   |   14 ++++++++++++++
 import.c    |   15 ++++++---------
 keyserver.c |   22 ++++++++++++++++++----
 trustdb.c   |   14 ++++++++++++++
 trustdb.h   |    5 +++--
 5 files changed, 55 insertions(+), 15 deletions(-)


Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.694 gnupg/g10/ChangeLog:1.695
--- gnupg/g10/ChangeLog:1.694	Sat Feb  5 01:00:35 2005
+++ gnupg/g10/ChangeLog	Sun Feb  6 18:38:43 2005
@@ -1,3 +1,17 @@
+2005-02-06  David Shaw  <dshaw at jabberwocky.com>
+
+	* trustdb.h, trustdb.c (trustdb_check_or_update): New.  If the
+	trustdb is dirty and --interactive is set, do an --update-trustdb.
+	If not interactive, do a --check_trustdb unless
+	--no-auto-check-trustdb is set.
+
+	* import.c (import_keys_internal): Moved from here.
+
+	* keyserver.c (keyserver_refresh): Call it here after all
+	refreshing has happened so that we don't rebuild after each
+	preferred keyserver set of imports, but do one big rebuild at the
+	end.  This is Debian bug #293816, noted by Kurt Roeckx.
+
 2005-02-04  David Shaw  <dshaw at jabberwocky.com>
 
 	* getkey.c (merge_selfsigs_subkey): Merged away definition from
Index: gnupg/g10/import.c
diff -u gnupg/g10/import.c:1.120 gnupg/g10/import.c:1.121
--- gnupg/g10/import.c:1.120	Thu Jan 20 18:21:40 2005
+++ gnupg/g10/import.c	Sun Feb  6 18:38:43 2005
@@ -1,6 +1,6 @@
 /* import.c - import a key into our key storage.
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
- *               2004, 2005 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ *               2005 Free Software Foundation, Inc.
  *
  * This file is part of GnuPG.
  *
@@ -193,18 +193,15 @@
         import_print_stats (stats);
         import_release_stats_handle (stats);
     }
+
     /* If no fast import and the trustdb is dirty (i.e. we added a key
        or userID that had something other than a selfsig, a signature
        that was other than a selfsig, or any revocation), then
        update/check the trustdb if the user specified by setting
        interactive or by not setting no-auto-check-trustdb */
-    if (!(options&IMPORT_FAST) && trustdb_pending_check())
-      {
-	if (opt.interactive)
-	  update_trustdb();
-	else if (!opt.no_auto_check_trustdb)
-	  check_trustdb();
-      }
+
+    if(!(options&IMPORT_FAST))
+      trustdb_check_or_update();
 
     return rc;
 }
Index: gnupg/g10/keyserver.c
diff -u gnupg/g10/keyserver.c:1.79 gnupg/g10/keyserver.c:1.80
--- gnupg/g10/keyserver.c:1.79	Wed Jan 26 22:20:30 2005
+++ gnupg/g10/keyserver.c	Sun Feb  6 18:38:43 2005
@@ -35,6 +35,7 @@
 #include "ttyio.h"
 #include "options.h"
 #include "packet.h"
+#include "trustdb.h"
 #include "keyserver-internal.h"
 #include "util.h"
 
@@ -1628,11 +1629,17 @@
 {
   int rc,count,numdesc,fakev3=0;
   KEYDB_SEARCH_DESC *desc;
+  unsigned int options=opt.keyserver_options.import_options;
 
-  /* We switch merge_only on during a refresh, as 'refresh' should
-     never import new keys, even if their keyids match.  Is it worth
-     preserving the old merge_only value here? */
-  opt.import_options|=IMPORT_MERGE_ONLY;
+  /* We switch merge-only on during a refresh, as 'refresh' should
+     never import new keys, even if their keyids match. */
+  opt.keyserver_options.import_options|=IMPORT_MERGE_ONLY;
+
+  /* Similarly, we switch on fast-import, since refresh may make
+     multiple import sets (due to preferred keyserver URLs).  We don't
+     want each set to rebuild the trustdb.  Instead we do it once at
+     the end here. */
+  opt.keyserver_options.import_options|=IMPORT_FAST;
 
   /* If refresh_add_fake_v3_keyids is on and it's a HKP or MAILTO
      scheme, then enable fake v3 keyid generation. */
@@ -1696,6 +1703,13 @@
 
   m_free(desc);
 
+  opt.keyserver_options.import_options=options;
+
+  /* If the original options didn't have fast import, and the trustdb
+     is dirty, rebuild. */
+  if(!(opt.keyserver_options.import_options&IMPORT_FAST))
+    trustdb_check_or_update();
+
   return rc;
 }
 
Index: gnupg/g10/trustdb.c
diff -u gnupg/g10/trustdb.c:1.136 gnupg/g10/trustdb.c:1.137
--- gnupg/g10/trustdb.c:1.136	Wed Dec 15 06:16:53 2004
+++ gnupg/g10/trustdb.c	Sun Feb  6 18:38:43 2005
@@ -624,6 +624,20 @@
   return pending_check_trustdb;
 }
 
+/* If the trustdb is dirty, and we're interactive, update it.
+   Otherwise, check it unless no-auto-check-trustdb is set. */
+void
+trustdb_check_or_update(void)
+{
+  if(trustdb_pending_check())
+    {
+      if(opt.interactive)
+	update_trustdb();
+      else if(!opt.no_auto_check_trustdb)
+	check_trustdb();
+    }
+}
+
 void
 read_trust_options(byte *trust_model,ulong *created,ulong *nextcheck,
 		   byte *marginals,byte *completes,byte *cert_depth)
Index: gnupg/g10/trustdb.h
diff -u gnupg/g10/trustdb.h:1.49 gnupg/g10/trustdb.h:1.50
--- gnupg/g10/trustdb.h:1.49	Wed Nov 24 06:25:03 2004
+++ gnupg/g10/trustdb.h	Sun Feb  6 18:38:43 2005
@@ -1,6 +1,6 @@
 /* trustdb.h - Trust database
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
- *               2004 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ *               2005 Free Software Foundation, Inc.
  *
  * This file is part of GnuPG.
  *
@@ -53,6 +53,7 @@
 
 void revalidation_mark (void);
 int trustdb_pending_check(void);
+void trustdb_check_or_update(void);
 
 int cache_disabled_value(PKT_public_key *pk);
 




More information about the Gnupg-commits mailing list