mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Add a function to find the mac address on a passthrough mac entry by username(if present) in the <username> tag of the entry.
This commit is contained in:
parent
4fc68c5aa4
commit
fac13a5eb3
@ -785,6 +785,18 @@ function captiveportal_passthrumac_configure($lock = false) {
|
||||
return $rules;
|
||||
}
|
||||
|
||||
function captiveportal_passthrumac_findbyname($username) {
|
||||
global $config;
|
||||
|
||||
if (is_array($config['captiveportal']['passthrumac'])) {
|
||||
foreach ($config['captiveportal']['passthrumac'] as $macent) {
|
||||
if ($macent['username'] == $username)
|
||||
return $macent;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* table (3=IN)/(4=OUT) hold allowed ip's without bw limits
|
||||
* table (5=IN)/(6=OUT) hold allowed ip's with bw limit.
|
||||
|
||||
@ -64,8 +64,15 @@ if ($_POST) {
|
||||
clear_subsystem_dirty('passthrumac');
|
||||
}
|
||||
|
||||
if ($_POST['delmac'] && $_POST['postafterlogin']) {
|
||||
if (is_array($a_passthrumacs)) {
|
||||
if ($_POST['postafterlogin']) {
|
||||
if (!is_array($a_passthrumacs))
|
||||
exit;
|
||||
if ($_POST['username']) {
|
||||
$mac = captiveportal_passthrumac_findbyname($_POST['username']);
|
||||
if (!empty($mac))
|
||||
$_POST['delmac'] = $mac['mac'];
|
||||
}
|
||||
if ($_POST['delmac']) {
|
||||
$found = false;
|
||||
foreach ($a_passthrumacs as $idx => $macent) {
|
||||
if ($macent['mac'] == $_POST['delmac']) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user