- 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 adolf.belka@ipfire.org Signed-off-by: Adolf Belka adolf.belka@ipfire.org --- 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;
- 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 adolf.belka@ipfire.org Signed-off-by: Adolf Belka adolf.belka@ipfire.org --- 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;