1
0
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:
Werner Koch 2015-08-04 12:28:17 +02:00
parent d22be79d9b
commit f05a63b104
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -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;
} }