diff options
author | Phil Davis <phil.davis@inf.org> | 2014-11-11 00:19:23 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2014-11-11 00:19:23 +0545 |
commit | 34c2b8f24f6dc0a083205d1ecb5e751cc015dcdb (patch) | |
tree | c410210af66c00f5083c45e20c1f77a0d0799085 /usr/local/www/services_unbound_host_edit.php | |
parent | 84c4efc429607257032e372f55ae809171997778 (diff) | |
download | pfsense-34c2b8f24f6dc0a083205d1ecb5e751cc015dcdb.zip pfsense-34c2b8f24f6dc0a083205d1ecb5e751cc015dcdb.tar.gz |
Stop FQDN in hostname field
Diffstat (limited to 'usr/local/www/services_unbound_host_edit.php')
-rw-r--r-- | usr/local/www/services_unbound_host_edit.php | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/usr/local/www/services_unbound_host_edit.php b/usr/local/www/services_unbound_host_edit.php index 6a43a1e..c39832e 100644 --- a/usr/local/www/services_unbound_host_edit.php +++ b/usr/local/www/services_unbound_host_edit.php @@ -1,7 +1,7 @@ <?php /* $Id$ */ /* - services_unbound_edit_host.php + services_unbound_host_edit.php part of the pfSense project (https://www.pfsense.org) Copyright (C) 2014 Warren Baker (warren@decoy.co.za) All rights reserved. @@ -87,8 +87,15 @@ if ($_POST) { do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); - if (($_POST['host'] && !is_hostname($_POST['host']))) - $input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'."); + if ($_POST['host']) { + if (!is_hostname($_POST['host'])) { + $input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9, '_' and '-'. It may not start or end with '-'."); + } else { + if (!is_unqualified_hostname($_POST['host'])) { + $input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted"); + } + } + } if (($_POST['domain'] && !is_domain($_POST['domain']))) $input_errors[] = gettext("A valid domain must be specified."); @@ -125,8 +132,15 @@ if ($_POST) { var_dump(array('fields' => $aliasreqdfields, 'names' => $aliasreqdfieldsn, 'alias' => $alias)); do_input_validation($_POST, $aliasreqdfields, $aliasreqdfieldsn, $input_errors); - if (($alias['host'] && !is_hostname($alias['host']))) - $input_errors[] = gettext("Hostnames in alias list can only contain the characters A-Z, 0-9 and '-'."); + if ($alias['host']) { + if (!is_hostname($alias['host'])) { + $input_errors[] = gettext("Hostnames in an alias list can only contain the characters A-Z, 0-9 and '-'. They may not start or end with '-'."); + } else { + if (!is_unqualified_hostname($alias['host'])) { + $input_errors[] = gettext("A valid alias hostname is specified, but the domain name part should be omitted"); + } + } + } if (($alias['domain'] && !is_domain($alias['domain']))) $input_errors[] = gettext("A valid domain must be specified in alias list."); } |