diff options
author | Luiz Otavio O Souza <luiz@netgate.com> | 2015-09-15 11:55:35 -0500 |
---|---|---|
committer | Luiz Otavio O Souza <luiz@netgate.com> | 2015-09-15 11:55:35 -0500 |
commit | ce274e4545109efd712ac4e23cf99c8d4bb4d095 (patch) | |
tree | 87f5f3498f2dc086c290137b0e50c5c255117cb5 | |
parent | 32cf6a0c1c9ceb726e245343816342d173bb06d7 (diff) | |
download | pfsense-ce274e4545109efd712ac4e23cf99c8d4bb4d095.zip pfsense-ce274e4545109efd712ac4e23cf99c8d4bb4d095.tar.gz |
Check if our version of roll data is valid and if necessary, initialize
the database.
This fix the case where the database is not initialized because the used
field in backup file is empty.
Fix the issue #5113.
-rw-r--r-- | etc/inc/voucher.inc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 00cb397..863cc17 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -557,6 +557,9 @@ function voucher_configure_zone($sync = false) { foreach ($config['voucher'][$cpzone]['roll'] as $rollent) { $roll = $rollent['number']; + $len = ($rollent['count'] >> 3) + 1; + if (strlen(base64_decode($rollent['used'])) != $len) + $rollent['used'] = base64_encode(str_repeat("\000", $len)); voucher_write_used_db($roll, $rollent['used']); $minutes = $rollent['minutes']; $active_vouchers = array(); |