From patchwork Fri Jun 24 21:58:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 5704 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 (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4LV9xk1RLmz3x1y for ; Fri, 24 Jun 2022 21:59:06 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4LV9xh5N00zjC; Fri, 24 Jun 2022 21:59:04 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4LV9xh42PRz2y3C; Fri, 24 Jun 2022 21:59:04 +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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4LV9xg36xNz2xfN for ; Fri, 24 Jun 2022 21:59:03 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4LV9xf6HYMzjC; Fri, 24 Jun 2022 21:59:02 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1656107942; 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=gWOjeDsSqZXVNmv2/mGUMKbavsDCKTOpWYW16GXqKLg=; b=2DdXgT8Q3uSnmfC1nkSnRONE5P6Nh1cLd7RrDkminJo6wChziiQWJCVhdhORfE/3a4dBQZ 5W9NdfZCWB2XZzCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1656107942; 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=gWOjeDsSqZXVNmv2/mGUMKbavsDCKTOpWYW16GXqKLg=; b=HFLUr3rZeJdZ9KgUqxV6m7dofzVSmmmbKN1ztIof2NQKdTHbwR5UIFbcRu9qEAADSfK7Kg KrMdeqnV87wUb8PHcOS/QpwyCQRVoY2OsVWCqSSmoBAcLOT6PDzd/+O6jb7X9z//5FaWqZ nviKfH4/N0gwcOIHK0Kh95HRci3VekFJAadH7y9PZu/0aitmM3uakHU5GcTELg6yimr9/I QtwqxQCwmKEWVuRhQONHpVWEbFBh85YYKoBszaRXP+AU7gOwlcYB+nuT0pHsDcgtFwI1c+ IndHC3znBLiOcwhCeBJkLBaeSC7GasrkxPil8KrAM38STa6Bo+eIst5wIQUXbg== From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH 1/2] ovpnmain.cgi: Fix for bug #12865 - Static IP address pools - Add network - Name with space Date: Fri, 24 Jun 2022 23:58:56 +0200 Message-Id: <20220624215857.3518119-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" - The fix for bug #12428 removed spaces from the validhostname subroutine as hostnames are not supposed to have spaces - This resulted in spaces no longer being allowed for the Static IP Address Pools names - New subroutine created called validccdname in general-functions.pl Fixes: Bug #12865 Tested-by: Adolf Belka Signed-off-by: Adolf Belka --- html/cgi-bin/ovpnmain.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 736d17541..90d3710e4 100644 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -473,7 +473,7 @@ sub addccdnet return } - if(!&General::validhostname($ccdname)) + if(!&General::validccdname($ccdname)) { $errormessage=$Lang::tr{'ccd err invalidname'}; return; From patchwork Fri Jun 24 21:58:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 5705 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4LV9xy2c92z3x1y for ; Fri, 24 Jun 2022 21:59:18 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4LV9xx5P8Pz1G8; Fri, 24 Jun 2022 21:59:17 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4LV9xx4x2Pz2xmL; Fri, 24 Jun 2022 21:59:17 +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 4LV9xw0NnQz2xfN for ; Fri, 24 Jun 2022 21:59:16 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4LV9xv6LLyz136; Fri, 24 Jun 2022 21:59:15 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1656107955; 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=B5lKUXUmT/perITlulyDlxIk0q9cucjHJaSlMYl5o34=; b=7TiVgR26OF4JPQcPZ1FAcRI+ZxhtjNAGRt7rVhLQiJEIc7oe3D176jIGDC5gMlSo9YQEV4 2WuFRoZY5kS9YLAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1656107955; 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=B5lKUXUmT/perITlulyDlxIk0q9cucjHJaSlMYl5o34=; b=SbxRswNEt6qV4Pfog6qqcJpwc3Xko/PVl5ZGF0QpgoJb3kfhZVWJUfX44p3+2gdJ7p9N/F /E4K9S5Z6ninAnChBy/KzrKXXcTFtdeXGu4gm0py7XSS1c3+gaEA/HxGXbYPTu/LX2QaPo yShcnve7UIuWdLFwfvW8+tRVGYJxYKT60yp47/h7MEico5kAS7/Z6EO/yf0p8pFyuMLMdO KgDT45WujTxNgHLTzIsyj5bYM9NMjW+VuXE5j460ovG6SZ/MFF7yw+z8ke+THWrEmtnDuF CWyg8MkKN7i6drJqW0lGmPMVDrKnoV2hG4VZl0ctl9YLpv5gTblGq+YKsfikDQ== From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH 2/2] general-functions.pl: Fix for bug #12865 - Static IP address pools - Add network - Name wit> Date: Fri, 24 Jun 2022 23:58:57 +0200 Message-Id: <20220624215857.3518119-2-adolf.belka@ipfire.org> In-Reply-To: <20220624215857.3518119-1-adolf.belka@ipfire.org> References: <20220624215857.3518119-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" - The fix for bug #12428 removed spaces from the validhostname subroutine as hostnames are not supposed to have spaces - This resulted in spaces no longer being allowed for the Static IP Address Pools names - New subroutine created called validccdname. This allows letters, upper and lower case, numbers, spaces and dashes Fixes: Bug #12865 Tested-by: Adolf Belka Signed-off-by: Adolf Belka --- config/cfgroot/general-functions.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 6f49585dc..16a05cecf 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -721,6 +721,21 @@ sub validhostname return 1; } +sub validccdname +{ + # Checks a ccdname for letters, numbers and spaces + my $ccdname = $_[0]; + + # ccdname should be at least one character in length + # but no more than 63 characters + if (length ($ccdname) < 1 || length ($ccdname) > 63) { + return 0;} + # Only valid characters are a-z, A-Z, 0-9, space and - + if ($ccdname !~ /^[a-zA-Z0-9 -]*$/) { + return 0;} + return 1; +} + sub validdomainname { my $part;