diff options
author | Ermal <eri@pfsense.org> | 2012-12-18 09:19:34 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2012-12-18 09:20:22 +0000 |
commit | 26ee5aafa2787c9249b50a57a7ab9977e6303fe8 (patch) | |
tree | e3e3b0a40271588a9bee5cd4ff17632167bb2030 /etc/inc/voucher.inc | |
parent | a56c90a2f66368b6e9f1ade3072e7b457ed245a1 (diff) | |
download | pfsense-26ee5aafa2787c9249b50a57a7ab9977e6303fe8.zip pfsense-26ee5aafa2787c9249b50a57a7ab9977e6303fe8.tar.gz |
Convert the CP db to sqlite rather than a text file. Some more optimizations might be needed and probably vouchers db might need conversion as well.
Diffstat (limited to 'etc/inc/voucher.inc')
-rw-r--r-- | etc/inc/voucher.inc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 3a8c0bc..094b829 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -215,8 +215,6 @@ function voucher_expire($voucher_received) { // split into an array. Useful for multiple vouchers given $a_vouchers_received = preg_split("/[\t\n\r ]+/s", $voucher_received); $active_dirty = false; - - $cpdb = captiveportal_read_db(false, 4); /* Indexed by Voucher */ $unsetindexes[] = array(); // go through all received vouchers, check their valid and extract @@ -250,11 +248,10 @@ function voucher_expire($voucher_received) { captiveportal_syslog("{$voucher} ({$roll}/{$nr}) forced to expire"); /* Check if this voucher has any active sessions */ - if (isset($cpdb[$voucher])) { - $cpentry = $cpdb[$voucher]; + $cpentry = captiveportal_read_db("WHERE username = '{$voucher}'"); + if (!empty($cpentry)) { captiveportal_disconnect($cpentry,null,13); captiveportal_logportalauth($cpentry[4],$cpentry[3],$cpentry[2],"FORCLY TERMINATING VOUCHER {$voucher} SESSION"); - unset($cpdb[$voucher]); $unsetindexes[] = $cpentry[5]; } } else @@ -289,7 +286,7 @@ function voucher_expire($voucher_received) { /* Write database */ if (!empty($unsetindexes)) - captiveportal_write_db($cpdb, false, $unsetindexes); + captiveportal_remove_entries($unsetindexes); return true; } |