aboutsummaryrefslogtreecommitdiffstats
path: root/common/userids.c
diff options
context:
space:
mode:
authorNeal H. Walfield <[email protected]>2015-12-02 10:07:05 +0000
committerNeal H. Walfield <[email protected]>2015-12-02 11:03:28 +0000
commit10cca02c4c70eee993d4df0a1d20ae841992efe9 (patch)
treeaa68421d5a4cc113249fea197f61aff036284ba1 /common/userids.c
parentdirmngr: Improve error handling. (diff)
downloadgnupg-10cca02c4c70eee993d4df0a1d20ae841992efe9.tar.gz
gnupg-10cca02c4c70eee993d4df0a1d20ae841992efe9.zip
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 <[email protected]> Reported-by: Kristian Fiskerstrand <[email protected]> Fixes-commit: f99830b7 Fixes-commit: e8c53fca
Diffstat (limited to 'common/userids.c')
-rw-r--r--common/userids.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/common/userids.c b/common/userids.c
index f9a003607..e094c69fa 100644
--- a/common/userids.c
+++ b/common/userids.c
@@ -282,7 +282,9 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
if (desc->exact)
hexlength--; /* Remove the bang. */
- if ((hexlength == 8 && s[hexlength] == 0)
+ if ((hexlength == 8
+ && (s[hexlength] == 0
+ || (s[hexlength] == '!' && s[hexlength + 1] == 0)))
|| (!hexprefix && hexlength == 9 && *s == '0'))
{
/* Short keyid. */
@@ -291,7 +293,9 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
desc->u.kid[1] = strtoul( s, NULL, 16 );
mode = KEYDB_SEARCH_MODE_SHORT_KID;
}
- else if ((hexlength == 16 && s[hexlength] == 0)
+ else if ((hexlength == 16
+ && (s[hexlength] == 0
+ || (s[hexlength] == '!' && s[hexlength + 1] == 0)))
|| (!hexprefix && hexlength == 17 && *s == '0'))
{
/* Long keyid. */
@@ -303,7 +307,9 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
desc->u.kid[1] = strtoul (s+8, NULL, 16);
mode = KEYDB_SEARCH_MODE_LONG_KID;
}
- else if ((hexlength == 32 && s[hexlength] == 0)
+ else if ((hexlength == 32
+ && (s[hexlength] == 0
+ || (s[hexlength] == '!' && s[hexlength + 1] == 0)))
|| (!hexprefix && hexlength == 33 && *s == '0'))
{
/* MD5 fingerprint. */
@@ -323,7 +329,9 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
}
mode = KEYDB_SEARCH_MODE_FPR16;
}
- else if ((hexlength == 40 && s[hexlength] == 0)
+ else if ((hexlength == 40
+ && (s[hexlength] == 0
+ || (s[hexlength] == '!' && s[hexlength + 1] == 0)))
|| (!hexprefix && hexlength == 41 && *s == '0'))
{
/* SHA1/RMD160 fingerprint. */