From patchwork Wed Aug 2 20:09:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 7064 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) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4RGNPW70D7z3wl6 for ; Wed, 2 Aug 2023 20:10:07 +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 4RGNPV2hvXzcX; Wed, 2 Aug 2023 20:10:06 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4RGNPV12dpz2xZH; Wed, 2 Aug 2023 20:10:06 +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 4RGNPS4CCsz2xW9 for ; Wed, 2 Aug 2023 20:10:04 +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 4RGNPR5yKczGB; Wed, 2 Aug 2023 20:10:03 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1691007003; 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; bh=gvUfMMKZGVLuE5RuS3yRtbh5ysns6Gn36U0jZ+kWYZQ=; b=EgK1sjBzfnsy73bvBefIaKSG2IfineIJzkK6SFtOEiSsldVOu1c9ndUdn34KWaVqzaFCBr QecBblbjCTR/y6Dg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1691007003; 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; bh=gvUfMMKZGVLuE5RuS3yRtbh5ysns6Gn36U0jZ+kWYZQ=; b=Ttulv1ZVx1z6/p1MAjsxOUqwLcr+jy9nnYZqrdaOH5t9TTwgS6N0prCayUCImCIeaaFpnv OyShaLWRnhxss7oW+VILspPwT8w3BayjEpl+PFVH898mSm06+Vll4apNVxyysz6vJN2k6F oaDOwkU7qA9FvJs2BvDjH8LPNtinBknYBcicUNh3xsEAXZyHbujrdq67qxawdvKzpDZbt/ eTheO1TPST2uiV1C4ca256ficAUKJSXokem5HxuTmfAlGYGGT235thI3srZDbBEMfntW5w 2h5rn8hdxmM8j+02K1TK2PjvHfb51eQ/vHd2ojWuLsg8r52w9K6Jdb3p26j0/Q== From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH] fwhosts.cgi: Fixes bug#13206 - no validation of location group name Date: Wed, 2 Aug 2023 22:09:55 +0200 Message-ID: <20230802200955.4802-1-adolf.belka@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" - Added validation code for the location group name. This is only validated when edited and not when created. - The code was copied from the section for creating the Services Group Name or the Network/Host Group Name. Fixes: Bug#13206 Tested-by: Adolf Belka Signed-off-by: Adolf Belka Reviewed-by: Stefan Schantl --- html/cgi-bin/fwhosts.cgi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi index baf745a0a..d6be6c40e 100644 --- a/html/cgi-bin/fwhosts.cgi +++ b/html/cgi-bin/fwhosts.cgi @@ -693,6 +693,9 @@ if ($fwhostsettings{'ACTION'} eq 'savelocationgrp') &General::readhasharray("$fwconfiginp", \%fwinp); &General::readhasharray("$fwconfigout", \%fwout); + # Check name + if (!&validhostname($grp)){$errormessage.=$Lang::tr{'fwhost err name'};} + # Check for existing group name. if (!&checkgroup($grp) && $fwhostsettings{'update'} ne 'on'){ $errormessage = $Lang::tr{'fwhost err grpexist'};