diff options
author | Erik Fonnesbeck <efonnes@gmail.com> | 2010-09-14 07:03:59 -0600 |
---|---|---|
committer | Erik Fonnesbeck <efonnes@gmail.com> | 2010-09-14 07:03:59 -0600 |
commit | 88efcf041a5705d1557a3fa88ce62a57dd7121f2 (patch) | |
tree | 97046cc22635d27eaf63846a782e60583d6a7790 | |
parent | 331a89ca5b2f0dacacfd18d04fa29163961b74c6 (diff) | |
download | pfsense-88efcf041a5705d1557a3fa88ce62a57dd7121f2.zip pfsense-88efcf041a5705d1557a3fa88ce62a57dd7121f2.tar.gz |
Do stricter validation of host names and domain names.
-rw-r--r-- | etc/inc/util.inc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 30f4566..f07e2aa 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -439,7 +439,7 @@ function is_hostname($hostname) { if (!is_string($hostname)) return false; - if (preg_match("/^([_a-z0-9\-]+\.?)+$/i", $hostname)) + 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; else return false; @@ -450,7 +450,7 @@ function is_domain($domain) { if (!is_string($domain)) return false; - if (preg_match("/^([a-z0-9\-]+\.?)+$/i", $domain)) + 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)) return true; else return false; |