diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2010-08-31 12:27:08 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2010-08-31 12:27:08 -0400 |
commit | d0ce82a3da414405f2ad27028a64c251253cca7a (patch) | |
tree | 866d46dc87cdbc8463d90a5677b7fe5546f19419 /usr/local/www | |
parent | d9a417f8f4068da48d6faad37080ebfa4216a470 (diff) | |
download | pfsense-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')
-rwxr-xr-x | usr/local/www/services_dhcp_edit.php | 6 |
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 { |