1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-22 14:57:02 +01:00

gpg: Fix duplicate key import due to legacy key in keyring.

* g10/keydb.c (keydb_search_fpr): Skip legacy keys.
--

A test case for this problem can be found at
GnuPG-bug-id: 2031

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-08-04 17:32:08 +02:00
parent f05a63b104
commit 4a326d7c9a
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1753,10 +1753,17 @@ keydb_search_kid (KEYDB_HANDLE hd, u32 *kid)
gpg_error_t
keydb_search_fpr (KEYDB_HANDLE hd, const byte *fpr)
{
gpg_error_t err;
KEYDB_SEARCH_DESC desc;
memset (&desc, 0, sizeof desc);
desc.mode = KEYDB_SEARCH_MODE_FPR;
memcpy (desc.u.fpr, fpr, MAX_FINGERPRINT_LEN);
return keydb_search (hd, &desc, 1, NULL);
do
{
err = keydb_search (hd, &desc, 1, NULL);
}
while (gpg_err_code (err) == GPG_ERR_LEGACY_KEY);
return err;
}