summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Embry <dse@webonastick.com>2012-03-15 17:14:24 -0400
committerDarren Embry <dse@webonastick.com>2012-03-15 17:14:24 -0400
commit290ef7e09a52e2d83b5a0444e2cf7e5ca0cf8f7f (patch)
treee99c528a0e01b085d0f195d4f28b87bc71c81ea2
parenta67b9fb95514803bc92497b42f070ce9b7e6f551 (diff)
downloadpfsense-290ef7e09a52e2d83b5a0444e2cf7e5ca0cf8f7f.zip
pfsense-290ef7e09a52e2d83b5a0444e2cf7e5ca0cf8f7f.tar.gz
support for xmlrpcauthuser and xmlrpcauthpass in $g.
also for some reason get_pkg_sizes() wasn't using credentials at all.
-rw-r--r--etc/inc/pfsense-utils.inc5
-rw-r--r--etc/inc/pkg-utils.inc12
2 files changed, 17 insertions, 0 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 17428fc..faa4e77 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -724,6 +724,11 @@ function call_pfsense_method($method, $params, $timeout = 0) {
$password = $config['system']['altpkgrepo']['password'];
$cli->setCredentials($username, $password);
}
+ elseif($g['xmlrpcauthuser'] && $g['xmlrpcauthpass']) {
+ $username = $g['xmlrpcauthuser'];
+ $password = $g['xmlrpcauthpass'];
+ $cli->setCredentials($username, $password);
+ }
$resp = $cli->send($msg, $timeout);
if(!is_object($resp)) {
log_error("XMLRPC communication error: " . $cli->errstr);
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc
index 6b3b6c4..feb0fab 100644
--- a/etc/inc/pkg-utils.inc
+++ b/etc/inc/pkg-utils.inc
@@ -176,6 +176,18 @@ function get_pkg_sizes($pkgs = 'all') {
$msg = new XML_RPC_Message('pfsense.get_pkg_sizes', array(php_value_to_xmlrpc($params)));
$xmlrpc_base_url = isset($config['system']['altpkgrepo']['enable']) ? $config['system']['altpkgrepo']['xmlrpcbaseurl'] : $g['xmlrpcbaseurl'];
$cli = new XML_RPC_Client($g['xmlrpcpath'], $xmlrpc_base_url);
+ // If the ALT PKG Repo has a username/password set, use it.
+ if($config['system']['altpkgrepo']['username'] &&
+ $config['system']['altpkgrepo']['password']) {
+ $username = $config['system']['altpkgrepo']['username'];
+ $password = $config['system']['altpkgrepo']['password'];
+ $cli->setCredentials($username, $password);
+ }
+ elseif($g['xmlrpcauthuser'] && $g['xmlrpcauthpass']) {
+ $username = $g['xmlrpcauthuser'];
+ $password = $g['xmlrpcauthpass'];
+ $cli->setCredentials($username, $password);
+ }
$resp = $cli->send($msg, 10);
if(!is_object($resp))
log_error("Could not get response from XMLRPC server!");
OpenPOWER on IntegriCloud