summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-12-07 11:32:16 +0000
committerErmal <eri@pfsense.org>2010-12-07 11:32:16 +0000
commitd064a115350a7460265cad5d4c50b5a5fcc91cfd (patch)
tree93d83be1306331ba2cb571ad6eda25ec3ee7875b /etc/inc
parent137f46d8939ac05856b183d81d749287f1fc40cc (diff)
downloadpfsense-d064a115350a7460265cad5d4c50b5a5fcc91cfd.zip
pfsense-d064a115350a7460265cad5d4c50b5a5fcc91cfd.tar.gz
Tighten checks a bit also when check_firmware_version is called return the config version too.
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/pfsense-utils.inc13
-rw-r--r--etc/inc/xmlrpc.inc13
2 files changed, 19 insertions, 7 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 5a29408..76d3510 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -728,13 +728,16 @@ function call_pfsense_method($method, $params, $timeout = 0) {
*/
function check_firmware_version($tocheck = "all", $return_php = true) {
global $g, $config;
+
$ip = gethostbyname($g['product_website']);
if($ip == $g['product_website'])
return false;
+
$rawparams = array("firmware" => array("version" => trim(file_get_contents('/etc/version'))),
"kernel" => array("version" => trim(file_get_contents('/etc/version_kernel'))),
"base" => array("version" => trim(file_get_contents('/etc/version_base'))),
- "platform" => trim(file_get_contents('/etc/platform'))
+ "platform" => trim(file_get_contents('/etc/platform')),
+ "config_version" => $config['version']
);
if($tocheck == "all") {
$params = $rawparams;
@@ -744,14 +747,16 @@ function check_firmware_version($tocheck = "all", $return_php = true) {
$params['platform'] = $rawparams['platform'];
}
}
- if($config['system']['firmware']['branch']) {
+ if($config['system']['firmware']['branch'])
$params['branch'] = $config['system']['firmware']['branch'];
- }
- if(!$versions = call_pfsense_method('pfsense.get_firmware_version', $params)) {
+
+ /* XXX: What is this method? */
+ if(!($versions = call_pfsense_method('pfsense.get_firmware_version', $params))) {
return false;
} else {
$versions["current"] = $params;
}
+
return $versions;
}
diff --git a/etc/inc/xmlrpc.inc b/etc/inc/xmlrpc.inc
index 61167bf..da71538 100644
--- a/etc/inc/xmlrpc.inc
+++ b/etc/inc/xmlrpc.inc
@@ -108,16 +108,23 @@ function php_value_to_xmlrpc($value, $force_array = false) {
*/
function xmlrpc_auth(&$params) {
global $config;
+
+ if (!is_array($config['system']['user']))
+ return false;
+ if (!isset($config['system']['user'][0]['password']))
+ return false;
+
$localpass = $config['system']['user'][0]['password'];
if(crypt($params[0], $localpass) == $localpass) {
array_shift($params);
return true;
- } else if(crypt($params['xmlrpcauth'], $localpass) != $localpass) {
+ } else if(crypt($params['xmlrpcauth'], $localpass) == $localpass) {
unset($params['xmlrpcauth']);
- return false;
+ return true;
}
unset($params['xmlrpcauth']);
+
return false;
}
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud