mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Do not bail on an invalid packet in the local keyring.
* g10/keydb.c (parse_keyblock_image): Treat invalid packet special. -- This is in particular useful to run --list-keys on a keyring with corrupted packets. The extra flush is to keep the diagnostic close to the regular --list-key output. Signed-off-by: Werner Koch <wk@gnupg.org> This is a backport from master with support for the unsupported v5 key handling.
This commit is contained in:
parent
d32963eeb3
commit
30f44957cc
15
g10/keydb.c
15
g10/keydb.c
@ -1249,12 +1249,19 @@ parse_keyblock_image (iobuf_t iobuf, int pk_no, int uid_no,
|
||||
}
|
||||
if (err)
|
||||
{
|
||||
if (gpg_err_code (err) != GPG_ERR_UNKNOWN_VERSION)
|
||||
es_fflush (es_stdout);
|
||||
log_error ("parse_keyblock_image: read error: %s\n",
|
||||
gpg_strerror (err));
|
||||
if (gpg_err_code (err) == GPG_ERR_INV_PACKET)
|
||||
{
|
||||
log_error ("parse_keyblock_image: read error: %s\n",
|
||||
gpg_strerror (err));
|
||||
err = gpg_error (GPG_ERR_INV_KEYRING);
|
||||
free_packet (pkt, &parsectx);
|
||||
init_packet (pkt);
|
||||
continue;
|
||||
}
|
||||
/* Unknown version maybe due to v5 keys - we treat this
|
||||
* error different. */
|
||||
if (gpg_err_code (err) != GPG_ERR_UNKNOWN_VERSION)
|
||||
err = gpg_error (GPG_ERR_INV_KEYRING);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user