1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-01 22:28:02 +02:00

Repalce an assert by a proper error message.

This commit is contained in:
Werner Koch 2009-07-17 11:24:51 +00:00
parent 81d7fbc7cb
commit b478389753
2 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2009-07-17 Werner Koch <wk@g10code.com>
* keyring.c (keyring_rebuild_cache): Replace the assert by a
proper error message and allow to delete a bad keyblock.
2009-07-16 Werner Koch <wk@g10code.com>
* misc.c (has_invalid_email_chars): Let non-ascii characters pass

View File

@ -1399,7 +1399,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 = G10ERR_INV_KEYRING;
goto leave;
}
/* check all signature to set the signature's cache flags */
for (node=keyblock; node; node=node->next)