aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--g10/ChangeLog11
-rw-r--r--g10/g10.c2
-rw-r--r--g10/keydb.c4
-rw-r--r--g10/keydb.h2
-rw-r--r--g10/keyring.c13
-rw-r--r--g10/keyring.h3
-rw-r--r--g10/trustdb.c7
7 files changed, 30 insertions, 12 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index f6a5c0779..75c0d45b7 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,14 @@
+2004-01-20 David Shaw <[email protected]>
+
+ * g10.c (main), keydb.h, keydb.c (keydb_rebuild_caches),
+ keyring.h, keyring.c (keyring_rebuild_cache): Add "noisy" flag so
+ cache rebuilds can remain noisy when called for itself, and quiet
+ when called as part of the trustdb rebuild.
+
+ * trustdb.c (validate_keys): Rebuild the sig caches before
+ building the trustdb. Note that this is going to require some
+ architectual re-thinking, as it is agonizingly slow.
+
2004-01-19 David Shaw <[email protected]>
* sig-check.c (check_key_signature2): Comments.
diff --git a/g10/g10.c b/g10/g10.c
index 20d781cf3..d6d518b2d 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -3023,7 +3023,7 @@ main( int argc, char **argv )
case aRebuildKeydbCaches:
if (argc)
wrong_args ("--rebuild-keydb-caches");
- keydb_rebuild_caches ();
+ keydb_rebuild_caches (1);
break;
#ifdef ENABLE_CARD_SUPPORT
diff --git a/g10/keydb.c b/g10/keydb.c
index c67c36110..ab0c1463e 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -597,7 +597,7 @@ keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved)
* Rebuild the caches of all key resources.
*/
void
-keydb_rebuild_caches (void)
+keydb_rebuild_caches (int noisy)
{
int i, rc;
@@ -610,7 +610,7 @@ keydb_rebuild_caches (void)
case KEYDB_RESOURCE_TYPE_NONE: /* ignore */
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
- rc = keyring_rebuild_cache (all_resources[i].token);
+ rc = keyring_rebuild_cache (all_resources[i].token,noisy);
if (rc)
log_error (_("failed to rebuild keyring cache: %s\n"),
g10_errstr (rc));
diff --git a/g10/keydb.h b/g10/keydb.h
index 0d2a143a0..fab9eaac1 100644
--- a/g10/keydb.h
+++ b/g10/keydb.h
@@ -156,7 +156,7 @@ int keydb_update_keyblock (KEYDB_HANDLE hd, KBNODE kb);
int keydb_insert_keyblock (KEYDB_HANDLE hd, KBNODE kb);
int keydb_delete_keyblock (KEYDB_HANDLE hd);
int keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved);
-void keydb_rebuild_caches (void);
+void keydb_rebuild_caches (int noisy);
int keydb_search_reset (KEYDB_HANDLE hd);
#define keydb_search(a,b,c) keydb_search2((a),(b),(c),NULL)
int keydb_search2 (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc,
diff --git a/g10/keyring.c b/g10/keyring.c
index bf879df32..093bb0074 100644
--- a/g10/keyring.c
+++ b/g10/keyring.c
@@ -1310,7 +1310,7 @@ write_keyblock (IOBUF fp, KBNODE keyblock)
* This is only done for the public keyrings.
*/
int
-keyring_rebuild_cache (void *token)
+keyring_rebuild_cache (void *token,int noisy)
{
KEYRING_HANDLE hd;
KEYDB_SEARCH_DESC desc;
@@ -1356,8 +1356,8 @@ keyring_rebuild_cache (void *token)
if (rc)
goto leave;
lastresname = resname;
- if (!opt.quiet)
- log_info (_("checking keyring `%s'\n"), resname);
+ if (noisy && !opt.quiet)
+ log_info (_("caching keyring `%s'\n"), resname);
rc = create_tmp_file (resname, &bakfilename, &tmpfilename, &tmpfp);
if (rc)
goto leave;
@@ -1402,8 +1402,8 @@ keyring_rebuild_cache (void *token)
if (rc)
goto leave;
- if ( !(++count % 50) && !opt.quiet)
- log_info(_("%lu keys checked so far (%lu signatures)\n"),
+ if ( !(++count % 50) && noisy && !opt.quiet)
+ log_info(_("%lu keys cached so far (%lu signatures)\n"),
count, sigcount );
} /* end main loop */
@@ -1414,7 +1414,8 @@ keyring_rebuild_cache (void *token)
log_error ("keyring_search failed: %s\n", g10_errstr(rc));
goto leave;
}
- log_info(_("%lu keys checked (%lu signatures)\n"), count, sigcount );
+ if(noisy || opt.verbose)
+ log_info(_("%lu keys cached (%lu signatures)\n"), count, sigcount );
if (tmpfp)
{
if (iobuf_close (tmpfp))
diff --git a/g10/keyring.h b/g10/keyring.h
index 528557a70..9b63f3235 100644
--- a/g10/keyring.h
+++ b/g10/keyring.h
@@ -23,7 +23,6 @@
#include "global.h"
-
typedef struct keyring_handle *KEYRING_HANDLE;
int keyring_register_filename (const char *fname, int secret, void **ptr);
@@ -41,6 +40,6 @@ int keyring_delete_keyblock (KEYRING_HANDLE hd);
int keyring_search_reset (KEYRING_HANDLE hd);
int keyring_search (KEYRING_HANDLE hd, KEYDB_SEARCH_DESC *desc,
size_t ndesc, size_t *descindex);
-int keyring_rebuild_cache (void *);
+int keyring_rebuild_cache (void *token,int noisy);
#endif /*GPG_KEYRING_H*/
diff --git a/g10/trustdb.c b/g10/trustdb.c
index 95d8c38c5..84212a3ce 100644
--- a/g10/trustdb.c
+++ b/g10/trustdb.c
@@ -1944,6 +1944,13 @@ validate_keys (int interactive)
KeyHashTable stored,used,full_trust;
u32 start_time, next_expire;
+ /* Make sure we have all sigs cached. TODO: This is going to
+ require some architectual re-thinking, as it is agonizingly slow.
+ Perhaps combine this with reset_trust_records(), or only check
+ the caches on keys that are actually involved in the web of
+ trust. */
+ keydb_rebuild_caches(0);
+
start_time = make_timestamp ();
next_expire = 0xffffffff; /* set next expire to the year 2106 */
stored = new_key_hash_table ();