summaryrefslogtreecommitdiffstats
path: root/dirmngr/http.c
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2017-07-18 12:53:55 +0200
committerJustus Winter <justus@g10code.com>2017-07-18 13:56:33 +0200
commitb231959728a0056094134e0fca8cc916c24ef37e (patch)
tree0dce1a2f158ac5b1fa6fe492bc95fcb937668f27 /dirmngr/http.c
parentdirmngr: Fix memory leak. (diff)
downloadgnupg2-b231959728a0056094134e0fca8cc916c24ef37e.tar.xz
gnupg2-b231959728a0056094134e0fca8cc916c24ef37e.zip
dirmngr: Honor http keyserver URLs.
* dirmngr/http.c (parse_uri): Keep an unmodified copy of the URI. * dirmngr/http.h (struct parsed_uri_s): New field 'original'. * dirmngr/ks-action.c (ks_action_get): Properly handle http and https URLs. -- If a key has a http or https URL as preferred keyserver, fetch the key from there. Previously, dirmngr unconditionally interpreted these URLs as hkp servers. GnuPG-bug-id: 2924 Signed-off-by: Justus Winter <justus@g10code.com>
Diffstat (limited to 'dirmngr/http.c')
-rw-r--r--dirmngr/http.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/dirmngr/http.c b/dirmngr/http.c
index 7c9a68250..0cb27087c 100644
--- a/dirmngr/http.c
+++ b/dirmngr/http.c
@@ -1219,10 +1219,12 @@ parse_uri (parsed_uri_t *ret_uri, const char *uri,
{
gpg_err_code_t ec;
- *ret_uri = xtrycalloc (1, sizeof **ret_uri + strlen (uri));
+ *ret_uri = xtrycalloc (1, sizeof **ret_uri + 2 * strlen (uri) + 1);
if (!*ret_uri)
return gpg_err_make (default_errsource, gpg_err_code_from_syserror ());
strcpy ((*ret_uri)->buffer, uri);
+ strcpy ((*ret_uri)->buffer + strlen (uri) + 1, uri);
+ (*ret_uri)->original = (*ret_uri)->buffer + strlen (uri) + 1;
ec = do_parse_uri (*ret_uri, 0, no_scheme_check, force_tls);
if (ec)
{