diff options
author | Ermal <eri@pfsense.org> | 2014-02-17 10:36:59 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2014-02-17 10:36:59 +0000 |
commit | bae729da39079601b262e805a34d3818c3b994dc (patch) | |
tree | 6e9d19ba9f785c991ea828629e82ff2d7344e773 /etc/inc/captiveportal.inc | |
parent | 89c7a9c870bbf1a68f3fe3e7109bdb547120e597 (diff) | |
download | pfsense-bae729da39079601b262e805a34d3818c3b994dc.zip pfsense-bae729da39079601b262e805a34d3818c3b994dc.tar.gz |
Consider setting of noconcurrent login for passthrough expiry of users. Fixes #3340
Diffstat (limited to 'etc/inc/captiveportal.inc')
-rw-r--r-- | etc/inc/captiveportal.inc | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 0c78ae6..fc813ad 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -786,27 +786,29 @@ function captiveportal_prune_old_automac() { $writecfg = false; foreach ($config['captiveportal'][$cpzone]['passthrumac'] as $eid => $emac) { if ($emac['logintype'] == "voucher") { - if (isset($tmpvoucherdb[$emac['username']])) { - $temac = $config['captiveportal'][$cpzone]['passthrumac'][$tmpvoucherdb[$emac['username']]]; - $ruleno = captiveportal_get_ipfw_passthru_ruleno($temac['mac']); - $pipeno = captiveportal_get_dn_passthru_ruleno($temac['mac']); - if ($ruleno) { - captiveportal_free_ipfw_ruleno($ruleno); - $macrules .= "delete {$ruleno}"; - ++$ruleno; - $macrules .= "delete {$ruleno}"; - } - if ($pipeno) { - captiveportal_free_dn_ruleno($pipeno); - $macrules .= "pipe delete {$pipeno}\n"; - ++$pipeno; - $macrules .= "pipe delete {$pipeno}\n"; + if (isset($config['captiveportal'][$cpzone]['noconcurrentlogins'])) { + if (isset($tmpvoucherdb[$emac['username']])) { + $temac = $config['captiveportal'][$cpzone]['passthrumac'][$tmpvoucherdb[$emac['username']]]; + $ruleno = captiveportal_get_ipfw_passthru_ruleno($temac['mac']); + $pipeno = captiveportal_get_dn_passthru_ruleno($temac['mac']); + if ($ruleno) { + captiveportal_free_ipfw_ruleno($ruleno); + $macrules .= "delete {$ruleno}"; + ++$ruleno; + $macrules .= "delete {$ruleno}"; + } + if ($pipeno) { + captiveportal_free_dn_ruleno($pipeno); + $macrules .= "pipe delete {$pipeno}\n"; + ++$pipeno; + $macrules .= "pipe delete {$pipeno}\n"; + } + $writecfg = true; + captiveportal_logportalauth($temac['username'], $temac['mac'], $temac['ip'], "DUPLICATE {$temac['username']} LOGIN - TERMINATING OLD SESSION"); + unset($config['captiveportal'][$cpzone]['passthrumac'][$tmpvoucherdb[$emac['username']]]); } - $writecfg = true; - captiveportal_logportalauth($temac['username'], $temac['mac'], $temac['ip'], "DUPLICATE {$temac['username']} LOGIN - TERMINATING OLD SESSION"); - unset($config['captiveportal'][$cpzone]['passthrumac'][$tmpvoucherdb[$emac['username']]]); + $tmpvoucherdb[$emac['username']] = $eid; } - $tmpvoucherdb[$emac['username']] = $eid; if (voucher_auth($emac['username']) <= 0) { $ruleno = captiveportal_get_ipfw_passthru_ruleno($emac['mac']); $pipeno = captiveportal_get_dn_passthru_ruleno($emac['mac']); @@ -828,6 +830,7 @@ function captiveportal_prune_old_automac() { } } } + unset($tmpvoucherdb); if (!empty($macrules)) { @file_put_contents("{$g['tmp_path']}/macentry.prunerules.tmp", $macrules); unset($macrules); |