summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_dhcp_edit.php
diff options
context:
space:
mode:
authorBerger Alexander <Alexander.Berger@finnova.ch>2015-05-07 17:03:01 +0200
committerBerger Alexander <Alexander.Berger@finnova.ch>2015-05-07 17:03:01 +0200
commit22b88bc4dc66b188c49e5b63518bf9617588cb0c (patch)
treec017c104aa48249d45d1dae8225b2c47236a0d8b /usr/local/www/services_dhcp_edit.php
parentf6f04195fe0970883cb76804e3d9a018468ef021 (diff)
downloadpfsense-22b88bc4dc66b188c49e5b63518bf9617588cb0c.zip
pfsense-22b88bc4dc66b188c49e5b63518bf9617588cb0c.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/www/services_dhcp_edit.php')
-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