From c60814a5ce13932d933b363abc0c60c12783ae2f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 13 Oct 2014 14:01:29 +0200 Subject: gpg: Allow importing keys with duplicated long key ids. * g10/keydb.c (keydb_handle): Add field no_caching. (keyblock_cache): Repalce field kid by fpr. (keydb_disable_caching): New. (keydb_search): Use the fingerprint as cache index. * g10/import.c (import_one): Use the fingerprint and not the kid to lookup the key. Call keydb_disable_caching beofre re-searching for update. * tests/openpgp/import.test: Add a test case. Signed-off-by: Werner Koch --- tests/openpgp/import.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/openpgp/import.test b/tests/openpgp/import.test index eb6860e88..a58db40fe 100755 --- a/tests/openpgp/import.test +++ b/tests/openpgp/import.test @@ -31,3 +31,16 @@ if $GPG --list-keys --with-colons $keyid \ else error "$goodkey: import failed (bug 1223)" fi + + +key1=$srcdir/samplekeys/dda252ebb8ebe1af-1.asc +key2=$srcdir/samplekeys/dda252ebb8ebe1af-2.asc +fpr1=9E669861368BCA0BE42DAF7DDDA252EBB8EBE1AF +fpr2=A55120427374F3F7AA5F1166DDA252EBB8EBE1AF +info "Checking import of two keys with colliding long key ids." +$GPG --delete-key --batch --yes $fpr1 $fpr2 2>/dev/null || true +$GPG --import $key1 || true +$GPG --import $key2 || true +n=$($GPG --list-keys --with-colons $fpr1 $fpr2 2>/dev/null \ + | grep '^pub:.:4096:1:DDA252EBB8EBE1AF:' | wc -l) +[ $n -ne 2 ] && error "Importing keys with long id collision failed" -- cgit v1.2.3