Make the voucher auth through xmlrpc work.

This commit is contained in:
Ermal 2014-03-07 17:34:55 +00:00
parent e327358bb4
commit fac36dfddf

View File

@ -53,6 +53,7 @@ function xmlrpc_sync_voucher_expire($vouchers, $syncip, $port, $password, $usern
/* Construct code that is run on remote machine */
$method = 'pfsense.exec_php';
$execcmd = <<<EOF
global \$cpzone;
require_once('/etc/inc/captiveportal.inc');
require_once('/etc/inc/voucher.inc');
\$cpzone = "$cpzone";
@ -108,6 +109,7 @@ function xmlrpc_sync_voucher_disconnect($dbent, $syncip, $port, $password, $user
$tmp_stop_time = (isset($stop_time)) ? $stop_time : "null";
$method = 'pfsense.exec_php';
$execcmd = <<<EOF
global \$cpzone;
require_once('/etc/inc/captiveportal.inc');
require_once('/etc/inc/voucher.inc');
\$cpzone = "$cpzone";
@ -163,6 +165,7 @@ function xmlrpc_sync_used_voucher($voucher_received, $syncip, $port, $password,
/* Construct code that is run on remote machine */
$method = 'pfsense.exec_php';
$execcmd = <<<EOF
global \$cpzone;
require_once('/etc/inc/voucher.inc');
\$cpzone = "$cpzone";
\$timeleft = voucher_auth("$voucher_received");
@ -201,7 +204,7 @@ EOF;
if (!is_array($config['voucher']))
$config['voucher'] = array();
if (is_array($toreturn['voucher']) && (count($toreturn['voucher']['roll']) <> count($config['voucher'][$cpzone]['roll']))) {
if (is_array($toreturn['voucher']) && is_array($toreturn['voucher']['roll'])) {
$config['voucher'][$cpzone]['roll'] = $toreturn['voucher']['roll'];
write_config("Captive Portal Voucher database synchronized with {$url}");
voucher_configure_zone(true);