diff options
author | Marcus Brinkmann <[email protected]> | 2012-01-03 17:13:19 +0000 |
---|---|---|
committer | Marcus Brinkmann <[email protected]> | 2012-01-03 17:13:19 +0000 |
commit | 0868997e186cd847663668f9d7a29806a12da2d2 (patch) | |
tree | 73645f778a2d16213723121a76d2b38ca90edfcc /keyserver/gpgkeys_hkp.c | |
parent | Add lost ChangeLog entry. (diff) | |
parent | Silence gcc warning. (diff) | |
download | gnupg-npth.tar.gz gnupg-npth.zip |
Merge branch 'master' into npthnpth
Conflicts:
ChangeLog-2011
Makefile.am
agent/ChangeLog-2011
agent/gpg-agent.c
dirmngr/ChangeLog-2011
dirmngr/dirmngr.c
doc/HACKING
g13/g13.c
po/de.po
scd/ChangeLog-2011
scd/apdu.c
scd/command.c
scd/scdaemon.c
scripts/gitlog-to-changelog
tools/ChangeLog-2011
Diffstat (limited to 'keyserver/gpgkeys_hkp.c')
-rw-r--r-- | keyserver/gpgkeys_hkp.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/keyserver/gpgkeys_hkp.c b/keyserver/gpgkeys_hkp.c index d43a61ab5..ac7039d06 100644 --- a/keyserver/gpgkeys_hkp.c +++ b/keyserver/gpgkeys_hkp.c @@ -241,9 +241,10 @@ static int get_key(char *getkey) { CURLcode res; - char request[MAX_URL+60]; + char request[MAX_URL+92]; char *offset; struct curl_writer_ctx ctx; + size_t keylen; memset(&ctx,0,sizeof(ctx)); @@ -269,14 +270,19 @@ get_key(char *getkey) strcat(request,port); strcat(request,opt->path); /* request is MAX_URL+55 bytes long - MAX_URL covers the whole URL, - including any supplied path. The 60 overcovers this /pks/... etc - string plus the 8 bytes of key id */ + including any supplied path. The 92 overcovers this /pks/... etc + string plus the 8, 16, or 40 bytes of key id/fingerprint */ append_path(request,"/pks/lookup?op=get&options=mr&search=0x"); - /* fingerprint or long key id. Take the last 8 characters and treat - it like a short key id */ - if(strlen(getkey)>8) - offset=&getkey[strlen(getkey)-8]; + /* send only fingerprint, long key id, or short keyid. see: + https://tools.ietf.org/html/draft-shaw-openpgp-hkp-00#section-3.1.1.1 */ + keylen = strlen(getkey); + if(keylen >= 40) + offset=&getkey[keylen-40]; + else if(keylen >= 16) + offset=&getkey[keylen-16]; + else if(keylen >= 8) + offset=&getkey[keylen-8]; else offset=getkey; |