summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2014-11-11 00:18:08 +0545
committerPhil Davis <phil.davis@inf.org>2014-11-11 00:18:08 +0545
commit84c4efc429607257032e372f55ae809171997778 (patch)
treeebb30f1b9b817df43cf3a443eb6efc945879a9b6 /usr
parent6bcbd862f70d003feb6cd529ed8f606d67f9b3a4 (diff)
downloadpfsense-84c4efc429607257032e372f55ae809171997778.zip
pfsense-84c4efc429607257032e372f55ae809171997778.tar.gz
Stop FQDN in hostname field
Diffstat (limited to 'usr')
-rw-r--r--usr/local/www/services_dnsmasq_edit.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/usr/local/www/services_dnsmasq_edit.php b/usr/local/www/services_dnsmasq_edit.php
index 2c3ab5f..bd9854e 100644
--- a/usr/local/www/services_dnsmasq_edit.php
+++ b/usr/local/www/services_dnsmasq_edit.php
@@ -85,8 +85,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.");
@@ -123,8 +130,14 @@ 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.");
OpenPOWER on IntegriCloud