summaryrefslogtreecommitdiffstats
path: root/g10/keyring.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2009-07-20 13:02:20 +0200
committerWerner Koch <wk@gnupg.org>2009-07-20 13:02:20 +0200
commit7ae15f002712c7d07f9d835b81b0ca8da096e49b (patch)
tree610af3a03993676179ec3eb267a3c09a5cad0149 /g10/keyring.c
parentFix bug 1090. (diff)
downloadgnupg2-7ae15f002712c7d07f9d835b81b0ca8da096e49b.tar.xz
gnupg2-7ae15f002712c7d07f9d835b81b0ca8da096e49b.zip
Fix bug 1091.
Doc fixes. Replace assert by error message.
Diffstat (limited to 'g10/keyring.c')
-rw-r--r--g10/keyring.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/g10/keyring.c b/g10/keyring.c
index 6b3c48987..7482724ad 100644
--- a/g10/keyring.c
+++ b/g10/keyring.c
@@ -1440,7 +1440,20 @@ keyring_rebuild_cache (void *token,int noisy)
log_error ("keyring_get_keyblock failed: %s\n", g10_errstr(rc));
goto leave;
}
- assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
+ if ( keyblock->pkt->pkttype != PKT_PUBLIC_KEY)
+ {
+ /* We had a few reports about corrupted keyrings; if we have
+ been called directly from the command line we delete such
+ a keyblock instead of bailing out. */
+ log_error ("unexpected keyblock found (pkttype=%d)%s\n",
+ keyblock->pkt->pkttype, noisy? " - deleted":"");
+ if (noisy)
+ continue;
+ log_info ("Hint: backup your keys and try running `%s'\n",
+ "gpg --rebuild-keydb-caches");
+ rc = gpg_error (GPG_ERR_INV_KEYRING);
+ goto leave;
+ }
/* check all signature to set the signature's cache flags */
for (node=keyblock; node; node=node->next)