Project

General

Profile

Bug #5113

Captive portal voucher expiration issue

Added by Jim Pingle about 4 years ago. Updated about 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Captive Portal
Target version:
Start date:
09/08/2015
Due date:
% Done:

100%

Estimated time:
Affected Version:
2.2.4
Affected Architecture:
All

Description

In a config with many voucher rolls, attempting to expire a block of ~100 vouchers can fail on a specific roll.

For example, in the attached config.xml portion for vouchers, using roll 39, attempt to expire all vouchers 80-180 using Status > Captive Portal, Expire Vouchers tab. The tab reports success but the .db file in /var/db/ for the voucher roll looks abnormal and the "Voucher Rolls" tab only reports 4 vouchers used. Several unrelated vouchers appear to be affected, easiest example is voucher 2 claims to be expired when it should not be.

Performing the same task on a fresh system with only 2-3 voucher rolls does not appear to present the problem. Expiring a similar block of vouchers (80-180) properly shows the correct number (101) for the "used" count.

On the problem config the voucher CLI program reports the voucher is OK but then it shows expired once it reaches the expiration check math tests.

Example of some test info from the broken config:

$cpzone = "guest";

$active = voucher_read_active_db("39");
$used = bin2hex(voucher_read_used_db("39"));
$uc = voucher_used_count("39");

var_dump($active);
var_dump($used);
var_dump($uc);

Output:

array(0) {
}
string(2) "1f" 
int(4)

On a working config (same PHP exec code as above), output is:

array(0) {
}
string(256) "00000000000000000000ffffffffffffffffffffffff1f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" 
int(101)

The attached voucher config section can be dropped in any other config. Needs an enabled Captive Portal zone called "guest".

bad-vouchers.xml (5.5 KB) bad-vouchers.xml Jim Pingle, 09/08/2015 12:45 PM

History

#1 Updated by Luiz Souza about 4 years ago

  • Status changed from New to Resolved
  • Assignee set to Luiz Souza
  • % Done changed from 0 to 100

There was a bug while restoring vouchers with incorrect data or without any data at all. The bug has been fixed.

Also available in: Atom PDF