diff options
-rw-r--r-- | etc/inc/pfsense-utils.inc | 16 | ||||
-rwxr-xr-x | etc/rc.filter_synchronize | 2 | ||||
-rwxr-xr-x | usr/local/www/xmlrpc.php | 21 |
3 files changed, 37 insertions, 2 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 76d3510..92013e3 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -760,11 +760,25 @@ function check_firmware_version($tocheck = "all", $return_php = true) { return $versions; } +/* + * host_firmware_version(): Return the versions used in this install + */ +function host_firmware_version() { + global $g, $config; + + return array( + "firmware" => array("version" => trim(file_get_contents('/etc/version', " \n"))), + "kernel" => array("version" => trim(file_get_contents('/etc/version_kernel', " \n"))), + "base" => array("version" => trim(file_get_contents('/etc/version_base', " \n"))), + "platform" => trim(file_get_contents('/etc/platform', " \n")), + "config_version" => $config['version'] + ); +} + function get_disk_info() { $diskout = ""; exec("/bin/df -h | /usr/bin/grep -w '/' | /usr/bin/awk '{ print $2, $3, $4, $5 }'", $diskout); return explode(' ', $diskout[0]); - // $size, $used, $avail, $cap } /****f* pfsense-utils/strncpy diff --git a/etc/rc.filter_synchronize b/etc/rc.filter_synchronize index 36567f7..a30825b 100755 --- a/etc/rc.filter_synchronize +++ b/etc/rc.filter_synchronize @@ -88,7 +88,7 @@ function remove_special_characters($string) { return $string; } -function carp_check_version($url, $password, $port = 80, $method = 'pfsense.check_firmware_version') { +function carp_check_version($url, $password, $port = 80, $method = 'pfsense.host_firmware_version') { global $config, $g; if(file_exists("{$g['varrun_path']}/booting") || $g['booting']) diff --git a/usr/local/www/xmlrpc.php b/usr/local/www/xmlrpc.php index fd56764..584e821 100755 --- a/usr/local/www/xmlrpc.php +++ b/usr/local/www/xmlrpc.php @@ -302,6 +302,24 @@ function check_firmware_version_xmlrpc($raw_params) { } /*****************************/ +$pfsense_firmware_version_doc = gettext("Basic XMLRPC wrapper for check_firmware_version. This function will return the output of check_firmware_version upon co +mpletion."); + +$pfsense_firmware_version_sig = array( + $XML_RPC_String, +); + +function pfsense_firmware_version_xmlrpc($raw_params) { + global $xmlrpc_g, $XML_RPC_String; + + $params = xmlrpc_params_to_php($raw_params); + if(!xmlrpc_auth($params)) + return $xmlrpc_g['return']['authfail']; + + return new XML_RPC_Response(new XML_RPC_Value(host_firmware_version(), $XML_RPC_String)); +} + +/*****************************/ $reboot_doc = gettext("Basic XMLRPC wrapper for rc.reboot."); $reboot_sig = array(array($XML_RPC_Boolean, $XML_RPC_String)); function reboot_xmlrpc($raw_params) { @@ -371,6 +389,9 @@ $server = new XML_RPC_Server( 'pfsense.check_firmware_version' => array('function' => 'check_firmware_version_xmlrpc', 'signature' => $check_firmware_version_sig, 'docstring' => $check_firmware_version_doc), + 'pfsense.host_firmware_version' => array('function' => 'pfsense_firmware_version_xmlrpc', + 'signature' => $host_firmware_version_sig, + 'docstring' => $host_firmware_version_doc), 'pfsense.reboot' => array('function' => 'reboot_xmlrpc', 'signature' => $reboot_sig, 'docstring' => $reboot_doc), |