summaryrefslogtreecommitdiffstats
path: root/etc/inc/pfsense-utils.inc
diff options
context:
space:
mode:
authorColin Smith <colin@pfsense.org>2005-04-02 06:45:15 +0000
committerColin Smith <colin@pfsense.org>2005-04-02 06:45:15 +0000
commitc793465339fa1663512792a62caa8e6167d32f25 (patch)
tree1e0442eb45f0e9c960a9e98e6b2aea6e79c360c8 /etc/inc/pfsense-utils.inc
parentf5ff6e0af30d75e464b1716eb31271a3a54f7161 (diff)
downloadpfsense-c793465339fa1663512792a62caa8e6167d32f25.zip
pfsense-c793465339fa1663512792a62caa8e6167d32f25.tar.gz
* Add check_firmware_version() for easy XMLRPC exposure.
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-rw-r--r--etc/inc/pfsense-utils.inc47
1 files changed, 47 insertions, 0 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 34478b2..9183112 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -995,4 +995,51 @@ function auto_upgrade() {
exec_rc_script_async("/etc/rc.firmware_auto {$firmwareurl} {$firmwarename} {$http_auth_username} {$http_auth_password}");
}
+/*
+ * check_firmware_version(): Check whether the current firmware installed is the most recently released.
+ */
+function check_firmware_version() {
+ global $g;
+ $versioncheck_base_url = $g['versioncheckbaseurl'];
+ $versioncheck_path = $g['versioncheckpath'];
+ if(isset($config['system']['alt_firmware_url']['enabled']) and isset($config['system']['alt_firmware_url']['versioncheck_base_url'])) {
+ $versioncheck_base_url = $config['system']['alt_firmware_url']['versioncheck_base_url'];
+ $versioncheck_path = '/checkversion.php';
+ }
+ $post = "platform=" . rawurlencode($g['platform']) .
+ "&version=" . rawurlencode(trim(file_get_contents("/etc/version")));
+ $rfd = @fsockopen($versioncheck_base_url, 80, $errno, $errstr, 3);
+ if ($rfd) {
+ $hdr = "POST {$versioncheck_path} HTTP/1.0\r\n";
+ $hdr .= "Content-Type: application/x-www-form-urlencoded\r\n";
+ $hdr .= "User-Agent: pfSense-webConfigurator/1.0\r\n";
+ $hdr .= "Host: www.pfSense.com\r\n";
+ $hdr .= "Content-Length: " . strlen($post) . "\r\n\r\n";
+
+ fwrite($rfd, $hdr);
+ fwrite($rfd, $post);
+
+ $inhdr = true;
+ $resp = "";
+ while (!feof($rfd)) {
+ $line = fgets($rfd);
+ if ($inhdr) {
+ if (trim($line) == "")
+ $inhdr = false;
+ } else {
+ $resp .= $line;
+ }
+ }
+
+ fclose($rfd);
+
+ if($_GET['autoupgrade'] <> "")
+ return;
+
+ return $resp;
+ }
+
+ return null;
+}
+
?>
OpenPOWER on IntegriCloud