mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Properly handle legacy keys while looking for a secret key.
* g10/getkey.c (have_secret_key_with_kid): Skip legacy keys. -- This fixes GnuPG-bug-id: 2031 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
d22be79d9b
commit
f05a63b104
@ -3058,8 +3058,14 @@ have_secret_key_with_kid (u32 *keyid)
|
|||||||
desc.mode = KEYDB_SEARCH_MODE_LONG_KID;
|
desc.mode = KEYDB_SEARCH_MODE_LONG_KID;
|
||||||
desc.u.kid[0] = keyid[0];
|
desc.u.kid[0] = keyid[0];
|
||||||
desc.u.kid[1] = keyid[1];
|
desc.u.kid[1] = keyid[1];
|
||||||
while (!result && !(err = keydb_search (kdbhd, &desc, 1, NULL)))
|
while (!result)
|
||||||
{
|
{
|
||||||
|
err = keydb_search (kdbhd, &desc, 1, NULL);
|
||||||
|
if (gpg_err_code (err) == GPG_ERR_LEGACY_KEY)
|
||||||
|
continue;
|
||||||
|
if (err)
|
||||||
|
break;
|
||||||
|
|
||||||
err = keydb_get_keyblock (kdbhd, &keyblock);
|
err = keydb_get_keyblock (kdbhd, &keyblock);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
@ -3085,6 +3091,7 @@ have_secret_key_with_kid (u32 *keyid)
|
|||||||
}
|
}
|
||||||
release_kbnode (keyblock);
|
release_kbnode (keyblock);
|
||||||
}
|
}
|
||||||
|
|
||||||
keydb_release (kdbhd);
|
keydb_release (kdbhd);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user