summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_captiveportal_vouchers.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2013-02-06 20:02:20 +0000
committerErmal <eri@pfsense.org>2013-02-06 20:02:20 +0000
commit472c5dc9962dd0b30eeed8b3e904ee6d048c5bdd (patch)
tree6d2d187e8ae161b0fb8c489a707d4af3bf8f1b1f /usr/local/www/services_captiveportal_vouchers.php
parent9ea2463a5b982dff170d7e081b896ca79de19ad7 (diff)
downloadpfsense-472c5dc9962dd0b30eeed8b3e904ee6d048c5bdd.zip
pfsense-472c5dc9962dd0b30eeed8b3e904ee6d048c5bdd.tar.gz
Revert "Correct URL creation for xmlrpc as well as some error checking"
This reverts commit 9ea2463a5b982dff170d7e081b896ca79de19ad7.
Diffstat (limited to 'usr/local/www/services_captiveportal_vouchers.php')
-rw-r--r--usr/local/www/services_captiveportal_vouchers.php66
1 files changed, 32 insertions, 34 deletions
diff --git a/usr/local/www/services_captiveportal_vouchers.php b/usr/local/www/services_captiveportal_vouchers.php
index d028c54..c2f154f 100644
--- a/usr/local/www/services_captiveportal_vouchers.php
+++ b/usr/local/www/services_captiveportal_vouchers.php
@@ -274,15 +274,12 @@ if ($_POST) {
$newvoucher['vouchersyncport'] && $newvoucher['vouchersyncdbip']) {
// Synchronize the voucher DB from the master node
require_once("xmlrpc.inc");
- if ($newvoucher['vouchersyncport'] == "443")
+ if($newvoucher['vouchersyncport'] == "443")
$url = "https://{$newvoucher['vouchersyncdbip']}";
- else if ($newvoucher['vouchersyncport'] == "80")
+ else
$url = "http://{$newvoucher['vouchersyncdbip']}";
- else
- $url = "http://{$newvoucher['vouchersyncdbip']}:{$newvoucher['vouchersyncport']}";
$execcmd = <<<EOF
- \$toreturn = array();
\$toreturn['voucher'] = \$config['voucher'][$cpzone];
unset(\$toreturn['vouchersyncport'], \$toreturn['vouchersyncpass'], \$toreturn['vouchersyncusername'], \$toreturn['vouchersyncdbip']);
@@ -293,23 +290,26 @@ EOF;
XML_RPC_encode($newvoucher['vouchersyncpass']),
XML_RPC_encode($execcmd)
);
- log_error("voucher XMLRPC sync data {$url}.");
+ $port = $newvoucher['vouchersyncport'];
+ log_error("voucher XMLRPC sync data {$url}:{$port}.");
$msg = new XML_RPC_Message('pfsense.exec_php', $params);
$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
$cli->setCredentials($newvoucher['vouchersyncusername'], $newvoucher['vouchersyncpass']);
$resp = $cli->send($msg, "250");
if(!is_object($resp)) {
$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", "");
$input_errors[] = $error;
} elseif($resp->faultCode()) {
$cli->setDebug(1);
$resp = $cli->send($msg, "250");
$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", "");
$input_errors[] = $error;
} else {
- log_error("The Captive Portal voucher database has been synchronized with {$url} (pfsense.exec_php).");
+ log_error("The Captive Portal voucher database has been synchronized with {$url}:{$port} (pfsense.exec_php).");
}
if (!$input_errors) {
$toreturn = XML_RPC_Decode($resp->value());
@@ -318,34 +318,32 @@ EOF;
$input_errors[] = "Could not synchronize the voucher database: Authentication Failed.";
} else {
// If we received back the voucher roll and other information then store it.
- if (is_array($toreturn['voucher'])) {
- if($toreturn['voucher']['roll'])
- $config['voucher'][$cpzone]['roll'] = $toreturn['voucher']['roll'];
- if($toreturn['voucher']['rollbits'])
- $config['voucher'][$cpzone]['rollbits'] = $toreturn['voucher']['rollbits'];
- if($toreturn['voucher']['ticketbits'])
- $config['voucher'][$cpzone]['ticketbits'] = $toreturn['voucher']['ticketbits'];
- if($toreturn['voucher']['checksumbits'])
- $config['voucher'][$cpzone]['checksumbits'] = $toreturn['voucher']['checksumbits'];
- if($toreturn['voucher']['magic'])
- $config['voucher'][$cpzone]['magic'] = $toreturn['voucher']['magic'];
- if($toreturn['voucher']['exponent'])
- $config['voucher'][$cpzone]['exponent'] = $toreturn['voucher']['exponent'];
- if($toreturn['voucher']['publickey'])
- $config['voucher'][$cpzone]['publickey'] = $toreturn['voucher']['publickey'];
- if($toreturn['voucher']['privatekey'])
- $config['voucher'][$cpzone]['privatekey'] = $toreturn['voucher']['privatekey'];
- if($toreturn['voucher']['msgnoaccess'])
- $config['voucher'][$cpzone]['msgnoaccess'] = $toreturn['voucher']['msgnoaccess'];
- if($toreturn['voucher']['msgexpired'])
- $config['voucher'][$cpzone]['msgexpired'] = $toreturn['voucher']['msgexpired'];
- if($toreturn['voucher']['msgnoaccess'])
- $config['voucher'][$cpzone]['msgnoaccess'] = $toreturn['voucher']['msgnoaccess'];
- $savemsg = gettext("Voucher database has been synchronized from {$url}:{$port}");
+ if($toreturn['voucher']['roll'])
+ $config['voucher'][$cpzone]['roll'] = $toreturn['voucher']['roll'];
+ if($toreturn['voucher']['rollbits'])
+ $config['voucher'][$cpzone]['rollbits'] = $toreturn['voucher']['rollbits'];
+ if($toreturn['voucher']['ticketbits'])
+ $config['voucher'][$cpzone]['ticketbits'] = $toreturn['voucher']['ticketbits'];
+ if($toreturn['voucher']['checksumbits'])
+ $config['voucher'][$cpzone]['checksumbits'] = $toreturn['voucher']['checksumbits'];
+ if($toreturn['voucher']['magic'])
+ $config['voucher'][$cpzone]['magic'] = $toreturn['voucher']['magic'];
+ if($toreturn['voucher']['exponent'])
+ $config['voucher'][$cpzone]['exponent'] = $toreturn['voucher']['exponent'];
+ if($toreturn['voucher']['publickey'])
+ $config['voucher'][$cpzone]['publickey'] = $toreturn['voucher']['publickey'];
+ if($toreturn['voucher']['privatekey'])
+ $config['voucher'][$cpzone]['privatekey'] = $toreturn['voucher']['privatekey'];
+ if($toreturn['voucher']['msgnoaccess'])
+ $config['voucher'][$cpzone]['msgnoaccess'] = $toreturn['voucher']['msgnoaccess'];
+ if($toreturn['voucher']['msgexpired'])
+ $config['voucher'][$cpzone]['msgexpired'] = $toreturn['voucher']['msgexpired'];
+ if($toreturn['voucher']['msgnoaccess'])
+ $config['voucher'][$cpzone]['msgnoaccess'] = $toreturn['voucher']['msgnoaccess'];
+ $savemsg = gettext("Voucher database has been synchronized from {$url}:{$port}");
- write_config();
- voucher_configure_zone(true);
- }
+ write_config();
+ voucher_configure_zone(true);
}
}
}
OpenPOWER on IntegriCloud