summaryrefslogtreecommitdiffstats
path: root/usr/local
diff options
context:
space:
mode:
authorBerger Alexander <Alexander.Berger@finnova.ch>2015-05-07 17:03:01 +0200
committerRenato Botelho <garga@FreeBSD.org>2015-05-11 11:36:15 -0300
commit32749275272fa4e6082699563018c113e576ab5c (patch)
treecef433b373ed128fc068a8188f08c913f752ec1e /usr/local
parent55395a834f154e7ed42d92904ba1976104c43c76 (diff)
downloadpfsense-32749275272fa4e6082699563018c113e576ab5c.zip
pfsense-32749275272fa4e6082699563018c113e576ab5c.tar.gz
Currently pfsense enforces unique unqualified hostnames for static dhcp leases, which is not correct as only the fully qualified hostname (hostname + domainname) must be unique. With this commit the old validation logic for uniqeness is modified such that hostnames no longer need to be unique and at the same time the fully qualified hostname hast to be unique.
This change makes it possible to have host with identical hostnames in different (sub)domains. For example myhost.sales.acme.com and myhost.support.acme.com will now be possible.
Diffstat (limited to 'usr/local')
-rw-r--r--usr/local/www/services_dhcp_edit.php22
1 files changed, 13 insertions, 9 deletions
diff --git a/usr/local/www/services_dhcp_edit.php b/usr/local/www/services_dhcp_edit.php
index bbf2cd2..a8a6024 100644
--- a/usr/local/www/services_dhcp_edit.php
+++ b/usr/local/www/services_dhcp_edit.php
@@ -187,15 +187,19 @@ if ($_POST) {
}
/* check for overlaps */
- foreach ($a_maps as $mapent) {
- if (isset($id) && ($a_maps[$id]) && ($a_maps[$id] === $mapent))
- continue;
-
- if ((($mapent['hostname'] == $_POST['hostname']) && $mapent['hostname']) || (($mapent['mac'] == $_POST['mac']) && $mapent['mac']) || (($mapent['ipaddr'] == $_POST['ipaddr']) && $mapent['ipaddr'] ) || (($mapent['cid'] == $_POST['cid']) && $mapent['cid'])) {
- $input_errors[] = gettext("This Hostname, IP, MAC address or Client identifier already exists.");
- break;
- }
- }
+ foreach ($a_maps as $mapent) {
+ if (isset($id) && ($a_maps[$id]) && ($a_maps[$id] === $mapent))
+ continue;
+ /* The fully qualified hostname (hostname + '.' + domainname) must be unique.
+ The unqualified hostname does not have to be unique as long as the fully
+ qualified hostname is unique. */
+ $existingFqn = "{$mapent['hostname']}.{$mapent['domain']}";
+ $candidateFqn = "{$_POST['hostname']}.{$_POST['domain']}";
+ if ((($existingFqn == $candidateFqn) && $mapent['hostname']) || (($mapent['mac'] == $_POST['mac']) && $mapent['mac']) || (($mapent['ipaddr'] == $_POST['ipaddr']) && $mapent['ipaddr'] ) || (($mapent['cid'] == $_POST['cid']) && $mapent['cid'])) {
+ $input_errors[] = gettext("This fully qualified hostname (Hostname + Domainname), IP, MAC address or Client identifier already exists.");
+ break;
+ }
+ }
/* make sure it's not within the dynamic subnet */
if ($_POST['ipaddr']) {
OpenPOWER on IntegriCloud