1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

common,gpg: Fix processing of search descriptions ending in '!'.

* g10/gpg.c (check_user_ids): If the search description describes a
keyid or fingerprint and ends in a '!', include the '!' in the
rewritten description.
* common/userids.c (classify_user_id): Accept keyids and fingerprints
ending in '!'.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Reported-by: Kristian Fiskerstrand
  <kristian.fiskerstrand@sumptuouscapital.com>
Fixes-commit: f99830b7
Fixes-commit: e8c53fca
This commit is contained in:
Neal H. Walfield 2015-12-02 11:07:05 +01:00
parent 9c34711539
commit 10cca02c4c
2 changed files with 25 additions and 5 deletions

View file

@ -2109,7 +2109,8 @@ check_user_ids (strlist_t *sp,
PKT_public_key *pk;
char fingerprint_bin[MAX_FINGERPRINT_LEN];
size_t fingerprint_bin_len = sizeof (fingerprint_bin);
char fingerprint[2 * MAX_FINGERPRINT_LEN + 1];
/* We also potentially need a ! at the end. */
char fingerprint[2 * MAX_FINGERPRINT_LEN + 1 + 1];
switch (t->flags >> 2)
@ -2198,6 +2199,17 @@ check_user_ids (strlist_t *sp,
fingerprint_from_pk (pk, fingerprint_bin, &fingerprint_bin_len);
assert (fingerprint_bin_len == sizeof (fingerprint_bin));
bin2hex (fingerprint_bin, MAX_FINGERPRINT_LEN, fingerprint);
if ((desc.mode == KEYDB_SEARCH_MODE_SHORT_KID
|| desc.mode == KEYDB_SEARCH_MODE_LONG_KID
|| desc.mode == KEYDB_SEARCH_MODE_FPR16
|| desc.mode == KEYDB_SEARCH_MODE_FPR20)
&& strchr (t->d, '!'))
{
int i = strlen (fingerprint);
fingerprint[i] = '!';
fingerprint[i + 1] = '\0';
}
add_to_strlist (&s2, fingerprint);
s2->flags = s->flags;