mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Fix hostname checking when entering a dhcp static mapping and replace "." with "_" when writing "host-name" option in dhcpd.conf. Resolves #159
This commit is contained in:
parent
64fba8ec93
commit
46c5b763ef
@ -341,6 +341,7 @@ EOD;
|
||||
|
||||
if ($sm['hostname']) {
|
||||
$dhhostname = str_replace(" ", "_", $sm['hostname']);
|
||||
$dhhostname = str_replace(".", "_", $dhhostname);
|
||||
$dhcpdconf .= " option host-name {$dhhostname};\n";
|
||||
}
|
||||
|
||||
|
||||
@ -109,8 +109,14 @@ if ($_POST) {
|
||||
/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
|
||||
$_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac']));
|
||||
|
||||
if (($_POST['hostname'] && !is_hostname($_POST['hostname']))) {
|
||||
$input_errors[] = "A valid host name must be specified.";
|
||||
if ($_POST['hostname']) {
|
||||
if (!is_hostname($_POST['hostname'])) {
|
||||
$input_errors[] = "A valid host name must be specified.";
|
||||
} else {
|
||||
if (strpos($_POST['hostname'],'.')) {
|
||||
$input_errors[] = "A valid hostname is specified, but the domain name part should be omitted";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
|
||||
$input_errors[] = "A valid IP address must be specified.";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user