summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_dhcp_edit.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2010-08-31 12:27:08 -0400
committerScott Ullrich <sullrich@pfsense.org>2010-08-31 12:27:08 -0400
commitd0ce82a3da414405f2ad27028a64c251253cca7a (patch)
tree866d46dc87cdbc8463d90a5677b7fe5546f19419 /usr/local/www/services_dhcp_edit.php
parentd9a417f8f4068da48d6faad37080ebfa4216a470 (diff)
downloadpfsense-d0ce82a3da414405f2ad27028a64c251253cca7a.zip
pfsense-d0ce82a3da414405f2ad27028a64c251253cca7a.tar.gz
Do not allow a numeric starting character or an ending hyphen in DHCP hostnames according to RFC1123
Diffstat (limited to 'usr/local/www/services_dhcp_edit.php')
-rwxr-xr-xusr/local/www/services_dhcp_edit.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/usr/local/www/services_dhcp_edit.php b/usr/local/www/services_dhcp_edit.php
index 51da0f4..b610542 100755
--- a/usr/local/www/services_dhcp_edit.php
+++ b/usr/local/www/services_dhcp_edit.php
@@ -111,6 +111,12 @@ if ($_POST) {
$_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac']));
if ($_POST['hostname']) {
+ preg_match("/^[0-9]/", $_POST['hostname'], $matches);
+ if($matches)
+ $input_errors[] = gettext("The hostname cannot start with a numeric character according to RFC1123");
+ preg_match("/.*\-/", $_POST['hostname'], $matches);
+ if($matches)
+ $input_errors[] = gettext("The hostname cannot end with a hyphen according to RFC1123");
if (!is_hostname($_POST['hostname'])) {
$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'.");
} else {
OpenPOWER on IntegriCloud