From 0342369ce001b9dba04dc79e7a4eb66fbda278e7 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 14 Jul 2016 14:00:37 +0200 Subject: [PATCH] gpg: Fix regression since 2.1 in --search-key with a fingerprint. * dirmngr/ks-engine-hkp.c (ks_hkp_search): Prefix fingerprint with 0x. -- pre-2.1 made sure that the 0x prefix was put before the fingerprint so that the search command works. Actually --recv-key should be used with a fingerprint but some users are using --search-key, probably to use the interactive mode. GnuPG-bug-id: 2412 Signed-off-by: Werner Koch --- dirmngr/ks-engine-hkp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dirmngr/ks-engine-hkp.c b/dirmngr/ks-engine-hkp.c index 636eaf781..bcc17504d 100644 --- a/dirmngr/ks-engine-hkp.c +++ b/dirmngr/ks-engine-hkp.c @@ -1207,12 +1207,16 @@ ks_hkp_search (ctrl_t ctrl, parsed_uri_t uri, const char *pattern, pattern = fprbuf; break; case KEYDB_SEARCH_MODE_FPR16: - bin2hex (desc.u.fpr, 16, fprbuf); + fprbuf[0] = '0'; + fprbuf[1] = 'x'; + bin2hex (desc.u.fpr, 16, fprbuf+2); pattern = fprbuf; break; case KEYDB_SEARCH_MODE_FPR20: case KEYDB_SEARCH_MODE_FPR: - bin2hex (desc.u.fpr, 20, fprbuf); + fprbuf[0] = '0'; + fprbuf[1] = 'x'; + bin2hex (desc.u.fpr, 20, fprbuf+2); pattern = fprbuf; break; default: