From patchwork Fri Oct 15 13:25:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 46273 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 88E103857800 for ; Fri, 15 Oct 2021 13:26:14 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id EDC62385842E for ; Fri, 15 Oct 2021 13:26:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EDC62385842E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from tarox.wildebeest.org (83-87-18-245.cable.dynamic.v4.ziggo.nl [83.87.18.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id DD0D03000340; Fri, 15 Oct 2021 15:26:05 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id C55764351E4B; Fri, 15 Oct 2021 15:26:04 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Subject: [PATCH] debuginfod-client: Stick to http:// + https:// + file:// protocols Date: Fri, 15 Oct 2021 15:25:48 +0200 Message-Id: <20211015132548.10058-1-mark@klomp.org> X-Mailer: git-send-email 2.18.4 MIME-Version: 1.0 X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Cc: Mark Wielaard , =?utf-8?q?Zbigniew_J=C4=99drzejewski-Szm?= =?utf-8?q?ek?= Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" 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 Signed-off-by: Mark Wielaard --- debuginfod/ChangeLog | 5 +++++ debuginfod/debuginfod-client.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index de833f7f..a91749e7 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,8 @@ +2021-10-15 Mark Wielaard + + * debuginfod-client.c (debuginfod_query_server): Set + CURLOPT_PROTOCOLS. + 2021-10-06 Di Chen PR28242 diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index 88e45567..bd947ae4 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -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);