summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/voucher.inc15
1 files changed, 10 insertions, 5 deletions
diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc
index 4b8398c..695857d 100644
--- a/etc/inc/voucher.inc
+++ b/etc/inc/voucher.inc
@@ -188,24 +188,26 @@ EOF;
$error = "A communications error occurred while attempting CaptivePortalVoucherSync XMLRPC sync with {$url}:{$port} (pfsense.exec_php).";
log_error($error);
file_notice("CaptivePortalVoucherSync", $error, "Communications error occurred", "");
- return 0; // $timeleft
+ return null; // $timeleft
} elseif($resp->faultCode()) {
$error = "An error code was received while attempting CaptivePortalVoucherSync XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
log_error($error);
file_notice("CaptivePortalVoucherSync", $error, "Error code received", "");
- return 0; // $timeleft
+ return null; // $timeleft
} else {
log_error("CaptivePortalVoucherSync XMLRPC reload data success with {$url}:{$port} (pfsense.exec_php).");
}
$toreturn = XML_RPC_Decode($resp->value());
if (!is_array($config['voucher']))
$config['voucher'] = array();
+
if (is_array($toreturn['voucher']) && (count($toreturn['voucher']['roll']) <> count($config['voucher'][$cpzone]['roll']))) {
$config['voucher'][$cpzone]['roll'] = $toreturn['voucher']['roll'];
write_config("Captive Portal Voucher database synchronized with {$url}");
voucher_configure_zone(true);
unset($toreturn['voucher']);
- }
+ } else if (!isset($toreturn['timeleft']))
+ return null;
return $toreturn['timeleft'];
}
@@ -437,9 +439,12 @@ function voucher_auth($voucher_received, $test = 0) {
}
// If we did a XMLRPC sync earlier check the timeleft
- if (!empty($config['voucher'][$cpzone]['vouchersyncdbip']))
- if($remote_time_used < $total_minutes)
+ if (!empty($config['voucher'][$cpzone]['vouchersyncdbip'])) {
+ if (!is_null($remote_time_used))
+ $total_minutes = $remote_time_used;
+ else if ($remote_time_used < $total_minutes)
$total_minutes -= $remote_time_used;
+ }
// All given vouchers were valid and this isn't simply a test.
// Write back the used DB's
OpenPOWER on IntegriCloud