mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Add is_unqualified_hostname function
This commit is contained in:
parent
894a0159a0
commit
6bcbd862f7
@ -670,7 +670,18 @@ function is_subnetoralias($subnet) {
|
||||
return is_subnet($subnet);
|
||||
}
|
||||
|
||||
/* returns true if $hostname is a valid hostname */
|
||||
/* returns true if $hostname is just a valid hostname (top part without any of the domain part) */
|
||||
function is_unqualified_hostname($hostname) {
|
||||
if (!is_string($hostname))
|
||||
return false;
|
||||
|
||||
if (preg_match('/^(?:[a-z0-9_]|[a-z0-9_][a-z0-9_\-]*[a-z0-9_])$/i', $hostname))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/* returns true if $hostname is a valid hostname, with or without being a fully-qualified domain name. */
|
||||
function is_hostname($hostname) {
|
||||
if (!is_string($hostname))
|
||||
return false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user