mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
dhcp: test root domain for DNSSL/radvd
PR: https://github.com/opnsense/core/issues/6529
This commit is contained in:
parent
c6d4ffd5e0
commit
1ff709dc91
@ -744,16 +744,17 @@ function is_hostname($hostname)
|
||||
}
|
||||
|
||||
/* returns true if $domain is a valid domain name */
|
||||
function is_domain($domain)
|
||||
function is_domain($domain, $allow_root = false)
|
||||
{
|
||||
if (!is_string($domain)) {
|
||||
return false;
|
||||
}
|
||||
if (preg_match('/^(?:(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$/i', $domain)) {
|
||||
} elseif (preg_match('/^(?:(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$/i', $domain)) {
|
||||
return true;
|
||||
} elseif ($allow_root && $domain == '.') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* returns true if $macaddr is a valid MAC address */
|
||||
|
||||
@ -118,7 +118,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
if (!empty($pconfig['radomainsearchlist'])) {
|
||||
$domain_array=preg_split("/[ ;]+/",$pconfig['radomainsearchlist']);
|
||||
foreach ($domain_array as $curdomain) {
|
||||
if (!is_domain($curdomain)) {
|
||||
if (!is_domain($curdomain, true)) {
|
||||
$input_errors[] = gettext("A valid domain search list must be specified.");
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user