]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
importd: harden curl file protocol handling
authorLuca Boccassi <luca.boccassi@gmail.com>
Fri, 10 Apr 2026 23:15:13 +0000 (00:15 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 14 Apr 2026 08:45:38 +0000 (10:45 +0200)
With old libcurl versions file:// can get redirects which can be messy, while
the new version rejects them. Set an option to explicit block them.

src/import/curl-util.c

index 48842a20b700b4be067988f5b4a9f2abc00fea74..52321d08e1a434071fd5b350b27aebfeb3d1f8a8 100644 (file)
@@ -293,6 +293,8 @@ int curl_glue_make(CURL **ret, const char *url, void *userdata) {
         if (curl_easy_setopt(c, CURLOPT_PROTOCOLS_STR, "HTTP,HTTPS,FILE") != CURLE_OK)
 #else
         if (curl_easy_setopt(c, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS|CURLPROTO_FILE) != CURLE_OK)
+                return -EIO;
+        if (curl_easy_setopt(c, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS) != CURLE_OK)
 #endif
                 return -EIO;