]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
debuginfod-client: Stick to http:// + https:// + file:// protocols
authorMark Wielaard <mark@klomp.org>
Fri, 15 Oct 2021 13:16:54 +0000 (15:16 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 15 Oct 2021 13:23:22 +0000 (15:23 +0200)
Make sure we don't use any of the more experimental protocols
libcurl might support. URLs can be redirected and we might want
to follow http -> https, but not e.g. gopher or pop3.

Suggested-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Mark Wielaard <mark@klomp.org>
debuginfod/ChangeLog
debuginfod/debuginfod-client.c

index de833f7fce9ab4ae96787d0f1c51a023ca13df95..a91749e78fa407494f6ad4b0a794f1c9c7756eba 100644 (file)
@@ -1,3 +1,8 @@
+2021-10-15  Mark Wielaard  <mark@klomp.org>
+
+       * debuginfod-client.c (debuginfod_query_server): Set
+       CURLOPT_PROTOCOLS.
+
 2021-10-06  Di Chen <dichen@redhat.com>
 
        PR28242
index 88e45567d44a47f65f8a70b702af3b109218bcaa..bd947ae417dc66394c4a0dd155ec84433ee2d611 100644 (file)
@@ -973,6 +973,10 @@ debuginfod_query_server (debuginfod_client *c,
       if (vfd >= 0)
        dprintf (vfd, "url %d %s\n", i, data[i].url);
 
+      /* Only allow http:// + https:// + file:// so we aren't being
+        redirected to some unsupported protocol.  */
+      curl_easy_setopt(data[i].handle, CURLOPT_PROTOCOLS,
+                      CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE);
       curl_easy_setopt(data[i].handle, CURLOPT_URL, data[i].url);
       if (vfd >= 0)
        curl_easy_setopt(data[i].handle, CURLOPT_ERRORBUFFER, data[i].errbuf);