From: Adolf Belka Date: Fri, 24 Jun 2022 21:58:57 +0000 (+0200) Subject: general-functions.pl: Fix for bug #12865 - Static IP address pools - Add network... X-Git-Tag: v2.27-core170~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b4618f9a3817e6d2c76a96b0db00f50fc8e0b57;p=ipfire-2.x.git general-functions.pl: Fix for bug #12865 - Static IP address pools - Add network - Name wit> - 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 --- diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 6f49585dc6..16a05cecf2 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;