diff options
author | Will Boyce <me@willboyce.com> | 2013-06-17 10:53:15 +0100 |
---|---|---|
committer | Will Boyce <me@willboyce.com> | 2013-06-17 11:01:18 +0100 |
commit | 84a27e31149688466272f5f93db8da02be9e35a6 (patch) | |
tree | 99cbee0ea933b28b42c13e125c7c0291d6866898 /usr/local/www/services_dhcp_edit.php | |
parent | 449f1dd2b24dfbb3ee25d290aac3260cc5b06e0b (diff) | |
download | pfsense-84a27e31149688466272f5f93db8da02be9e35a6.zip pfsense-84a27e31149688466272f5f93db8da02be9e35a6.tar.gz |
fix dhcp static mapping/client identifier validation
Diffstat (limited to 'usr/local/www/services_dhcp_edit.php')
-rwxr-xr-x | usr/local/www/services_dhcp_edit.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr/local/www/services_dhcp_edit.php b/usr/local/www/services_dhcp_edit.php index c0cab72..a90c3a6 100755 --- a/usr/local/www/services_dhcp_edit.php +++ b/usr/local/www/services_dhcp_edit.php @@ -145,6 +145,10 @@ if ($_POST) { do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + /* either MAC or Client-ID must be specified */ + if (empty($_POST['mac']) && empty($_POST['cid'])) + $input_errors[] = gettext("Either MAC address or Client identifier must be specified"); + /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ $_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac'])); @@ -175,8 +179,8 @@ if ($_POST) { if (isset($id) && ($a_maps[$id]) && ($a_maps[$id] === $mapent)) continue; - if ((($mapent['hostname'] == $_POST['hostname']) && $mapent['hostname']) || ($mapent['mac'] == $_POST['mac'])) { - $input_errors[] = gettext("This Hostname, IP or MAC address already exists."); + if ((($mapent['hostname'] == $_POST['hostname']) && $mapent['hostname']) || (($mapent['mac'] == $_POST['mac']) && $mapent['mac']) || (($mapent['cid'] == $_POST['cid']) && $mapent['cid'])) { + $input_errors[] = gettext("This Hostname, IP, MAC address or Client identifier already exists."); break; } } |