summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/voucher.inc
diff options
context:
space:
mode:
authorLuiz Otavio O Souza <luiz@netgate.com>2015-09-14 14:09:05 -0500
committerLuiz Otavio O Souza <luiz@netgate.com>2015-09-14 18:23:54 -0500
commit351b8519d66fd8cf4da9088c39741ac98f4f5c43 (patch)
tree4326ac41dac6973f48384f2601e03b58e9e7c37e /src/etc/inc/voucher.inc
parentd8123075d9ba5ee5cdf0daa15889c8abb9184f1c (diff)
downloadpfsense-351b8519d66fd8cf4da9088c39741ac98f4f5c43.zip
pfsense-351b8519d66fd8cf4da9088c39741ac98f4f5c43.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.
Diffstat (limited to 'src/etc/inc/voucher.inc')
-rw-r--r--src/etc/inc/voucher.inc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/etc/inc/voucher.inc b/src/etc/inc/voucher.inc
index 7075fa6..1346f90 100644
--- a/src/etc/inc/voucher.inc
+++ b/src/etc/inc/voucher.inc
@@ -586,6 +586,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();
OpenPOWER on IntegriCloud