diff options
author | Werner Koch <wk@gnupg.org> | 2012-01-06 15:17:49 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2012-01-06 15:17:49 +0100 |
commit | 957fe728466893bc63f5ccad197d3e245dca4bf3 (patch) | |
tree | ab5bdbfa355cf3fd7839aea6be3851c9e4808c18 /common | |
parent | gpg: Allow use of a standard space separated fingerprint. (diff) | |
download | gnupg2-957fe728466893bc63f5ccad197d3e245dca4bf3.tar.xz gnupg2-957fe728466893bc63f5ccad197d3e245dca4bf3.zip |
gpg: Make the double space in the middle of a fingerprint optional.
This change might help to c+p a fingerprint from an HTML page without
being enclosed in a "pre" tag.
* common/userids.c (classify_user_id): Skip a second blank in the
middle of a fingerprint.
Diffstat (limited to 'common')
-rw-r--r-- | common/userids.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/common/userids.c b/common/userids.c index 2b134451c..88593bf96 100644 --- a/common/userids.c +++ b/common/userids.c @@ -313,13 +313,16 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack) /* Still not found. Now check for a space separated OpenPGP v4 fingerprint like: 8061 5870 F5BA D690 3336 86D0 F2AD 85AC 1E42 B367 + or + 8061 5870 F5BA D690 3336 86D0 F2AD 85AC 1E42 B367 */ hexlength = strspn (s, " 0123456789abcdefABCDEF"); if (s[hexlength] && s[hexlength] != ' ') hexlength = 0; /* Followed by non-space. */ while (hexlength && s[hexlength-1] == ' ') hexlength--; /* Trim trailing spaces. */ - if (hexlength == 50 && (!s[hexlength] || s[hexlength] == ' ')) + if ((hexlength == 49 || hexlength == 50) + && (!s[hexlength] || s[hexlength] == ' ')) { int i, c; @@ -330,12 +333,12 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack) if (*s != ' ') break; s++; - if (i == 10) - { - if (*s != ' ') - break; - s++; - } + /* Skip the double space in the middle but + don't require it to help copying + fingerprints from sources which fold + multiple space to one. */ + if (i == 10 && *s == ' ') + s++; } c = hextobyte(s); |