diff options
author | Bill Marquette <billm@pfsense.org> | 2005-04-14 02:21:58 +0000 |
---|---|---|
committer | Bill Marquette <billm@pfsense.org> | 2005-04-14 02:21:58 +0000 |
commit | 4f3401e0db4bd4964bafe36020e7aebfa62afb59 (patch) | |
tree | 197b27020f574a5b8c19289b8315bdefdd338bbf /usr | |
parent | 629dd875f66411c15fbaefd59fc63f8ffa21f648 (diff) | |
download | pfsense-4f3401e0db4bd4964bafe36020e7aebfa62afb59.zip pfsense-4f3401e0db4bd4964bafe36020e7aebfa62afb59.tar.gz |
normalize MAC addresses
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/interfaces.php | 3 | ||||
-rwxr-xr-x | usr/local/www/interfaces_wan.php | 3 | ||||
-rwxr-xr-x | usr/local/www/services_captiveportal_mac_edit.php | 3 | ||||
-rwxr-xr-x | usr/local/www/services_dhcp_edit.php | 3 | ||||
-rwxr-xr-x | usr/local/www/services_wol.php | 8 | ||||
-rwxr-xr-x | usr/local/www/services_wol_edit.php | 3 |
6 files changed, 20 insertions, 3 deletions
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 11fc307..4edb6fe 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -117,6 +117,9 @@ if ($_POST) { do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } + /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ + $_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac'])); + if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) { $input_errors[] = "A valid IP address must be specified."; } diff --git a/usr/local/www/interfaces_wan.php b/usr/local/www/interfaces_wan.php index 11fc307..4edb6fe 100755 --- a/usr/local/www/interfaces_wan.php +++ b/usr/local/www/interfaces_wan.php @@ -117,6 +117,9 @@ if ($_POST) { do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } + /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ + $_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac'])); + if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) { $input_errors[] = "A valid IP address must be specified."; } diff --git a/usr/local/www/services_captiveportal_mac_edit.php b/usr/local/www/services_captiveportal_mac_edit.php index 8ef6340..cdf4910 100755 --- a/usr/local/www/services_captiveportal_mac_edit.php +++ b/usr/local/www/services_captiveportal_mac_edit.php @@ -59,7 +59,8 @@ if ($_POST) { do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - $_POST['mac'] = str_replace("-", ":", $_POST['mac']); + /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ + $_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac'])); if (($_POST['mac'] && !is_macaddr($_POST['mac']))) { $input_errors[] = "A valid MAC address must be specified. [".$_POST['mac']."]"; diff --git a/usr/local/www/services_dhcp_edit.php b/usr/local/www/services_dhcp_edit.php index b85df9a..1d8b934 100755 --- a/usr/local/www/services_dhcp_edit.php +++ b/usr/local/www/services_dhcp_edit.php @@ -68,6 +68,9 @@ if ($_POST) { $reqdfieldsn = explode(",", "MAC address"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ + $_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac'])); if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) { $input_errors[] = "A valid IP address must be specified."; diff --git a/usr/local/www/services_wol.php b/usr/local/www/services_wol.php index 90fe0fa..19164dc 100755 --- a/usr/local/www/services_wol.php +++ b/usr/local/www/services_wol.php @@ -42,10 +42,14 @@ if ($_POST || $_GET['mac']) { unset($input_errors); if ($_GET['mac']) { + /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ + $_GET['mac'] = strtolower(str_replace("-", ":", $_GET['mac'])); $mac = $_GET['mac']; $if = $_GET['if']; } else { - $mac = $_POST['mac_input']; + /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ + $_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac'])); + $mac = $_POST['mac']; $if = $_POST['interface']; } @@ -110,7 +114,7 @@ if ($_GET['act'] == "del") { <tr> <td width="22%" valign="top" class="vncellreq">MAC address</td> <td width="78%" class="vtable"> - <input name="mac_input" type="text" class="formfld" id="mac_input" size="20" value="<?=htmlspecialchars($mac);?>"> + <input name="mac" type="text" class="formfld" id="mac" size="20" value="<?=htmlspecialchars($mac);?>"> <br> Enter a MAC address <span class="vexpl"> in the following format: xx:xx:xx:xx:xx:xx</span></td></tr> <tr> diff --git a/usr/local/www/services_wol_edit.php b/usr/local/www/services_wol_edit.php index 73f222b..084de1a 100755 --- a/usr/local/www/services_wol_edit.php +++ b/usr/local/www/services_wol_edit.php @@ -58,6 +58,9 @@ if ($_POST) { $reqdfieldsn = explode(",", "Interface,MAC address"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ + $_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac'])); if (($_POST['mac'] && !is_macaddr($_POST['mac']))) { $input_errors[] = "A valid MAC address must be specified."; |