diff options
author | Chris Buechler <cmb@pfsense.org> | 2014-12-22 17:49:13 -0600 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2014-12-22 17:49:13 -0600 |
commit | 6422c6f14deb9bf3770c36c639d0f3d52b1cb115 (patch) | |
tree | 748e2b73991cddde3016432282ebfef44715bdd0 | |
parent | dc83dd4ca9da8b9e4fcffd8a49d9175e47273d9f (diff) | |
parent | 5454fd1b34657442eb094f7c272f0284b52433b8 (diff) | |
download | pfsense-6422c6f14deb9bf3770c36c639d0f3d52b1cb115.zip pfsense-6422c6f14deb9bf3770c36c639d0f3d52b1cb115.tar.gz |
Merge pull request #1394 from phil-davis/patch-13
-rw-r--r-- | etc/inc/util.inc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 5d4a1e2..232dd30 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -686,8 +686,13 @@ function is_hostname($hostname) { if (!is_string($hostname)) 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', $hostname)) - return true; + if (is_domain($hostname)) + if ((substr_count($hostname, ".") == 1) && ($hostname[strlen($hostname)-1] == ".")) { + /* Only a single dot at the end like "test." - hosts cannot be directly in the root domain. */ + return false; + } else { + return true; + } else return false; } |