From patchwork Tue Aug 1 15:48:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7058 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4RFfg04rs8z3wmm for ; Tue, 1 Aug 2023 15:49:16 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4RFfft1KzHz1vr; Tue, 1 Aug 2023 15:49:10 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4RFffs6Snkz30B7; Tue, 1 Aug 2023 15:49:09 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4RFffr3mh9z2x9l for ; Tue, 1 Aug 2023 15:49:08 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4RFffn2KqmzlG; Tue, 1 Aug 2023 15:49:05 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1690904945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2baZvhPFtu2oOxkdD0Tol3xmAN/Kb+ZS6rQeFG8m2GM=; b=Tr+I1dV8cvjKyzIwlVbw8U1+9hrjMc3s7ErvEm4LICL97mMKbsGnFxYKEeRT2uqWa9aVfn uF2M+2/31DqkwFBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1690904945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2baZvhPFtu2oOxkdD0Tol3xmAN/Kb+ZS6rQeFG8m2GM=; b=rN+roLhDI07OyvmTy4GFkkaVsHuJUPDBzxWgKAQnClkXUSfbXiKrND0OK6qDE48TvaqS3b e1LM1ow3y+po/Dn6s9h4ST+50+nYBsWgjf1oMvPAEmRVaaZ9n5Y0YqU9bE26mef32erT7n 0DrXukzq0cCjgm16VdwLQn9QGTCDVS7HWQNY/Ac+J7mf5RZznvoJaUeV5LMxtj2a9zH2Z+ yzL3ZiJi6XvedLOfiNLvHptGEG1/naF4O+pe6AzWvlRx0z282f49WGff5wh8LvOZFfX31J 55baM56CtRhEyaAITiyWyPmxH8cb81cKYTWuKtLOMsM+zAA/cxFqqeG5m7tj9Q== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCHv2 11/12] extrahd.cgi: Do not allow "/mnt" or "/media" as mount points Date: Tue, 1 Aug 2023 17:48:38 +0200 Message-Id: <20230801154839.2373-11-stefan.schantl@ipfire.org> In-Reply-To: <20230801154839.2373-1-stefan.schantl@ipfire.org> References: <20230801154839.2373-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Stefan Schantl Reviewed-by: Bernhard Bitsch --- html/cgi-bin/extrahd.cgi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi index 122f1d12d..bd64dff07 100644 --- a/html/cgi-bin/extrahd.cgi +++ b/html/cgi-bin/extrahd.cgi @@ -667,6 +667,10 @@ sub is_mounted ($) { sub is_valid_dir ($) { my ($mpoint) = @_; + # Do not allow "/mnt" or "/media" as mount points. + return if($mpoint eq "/mnt"); + return if($mpoint eq "/media"); + # Split the given mountpoint into pieces and store them # in a temporay array. my @tmp = split("/", $mpoint);