]> 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)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 14 Apr 2026 16:32:02 +0000 (17:32 +0100)
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.

(cherry picked from commit 275ec1160b62c90dad3264e484e976213b0ada30)

src/import/curl-util.c

index 4747d0993a8c38c72996ee43eb2148850aaf0f7d..066d3b3f802cbe574c6bf9bed34dba842a8a7014 100644 (file)
@@ -291,6 +291,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;