summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-09-30 18:21:44 -0300
committerRenato Botelho <renato@netgate.com>2015-09-30 18:21:44 -0300
commit60ff91f1b5dace563e1a6a62c3a90162782b3d8a (patch)
tree89110ebb0ac6c8297da7736a98de4081838f7358
parent9cffad03967f2f02a3d4632173ddfbfb0dbd21e7 (diff)
downloadpfsense-60ff91f1b5dace563e1a6a62c3a90162782b3d8a.zip
pfsense-60ff91f1b5dace563e1a6a62c3a90162782b3d8a.tar.gz
Remove /usr/share/zoneinfo.tgz and use FreeBSD stock zoneinfo. It fixes #4726
-rw-r--r--src/etc/inc/globals.inc3
-rw-r--r--src/etc/inc/system.inc37
-rw-r--r--src/etc/pfSense.obsoletedfiles2
-rw-r--r--src/usr/local/www/system.php7
-rw-r--r--src/usr/local/www/wizard.php5
-rw-r--r--src/usr/share/zoneinfo.tgzbin194726 -> 0 bytes
6 files changed, 24 insertions, 30 deletions
diff --git a/src/etc/inc/globals.inc b/src/etc/inc/globals.inc
index 2e937b1..3714032 100644
--- a/src/etc/inc/globals.inc
+++ b/src/etc/inc/globals.inc
@@ -88,7 +88,8 @@ $g = array(
"services_dhcp_server_enable" => true,
"wireless_regex" => "/^(ndis|wi|ath|an|ral|ural|iwi|wlan|rum|run|bwn|zyd|mwl|bwi|ipw|iwn|malo|uath|upgt|urtw|wpi)/",
"help_base_url" => "/help.php",
- "pkg_prefix" => "pfSense-pkg-"
+ "pkg_prefix" => "pfSense-pkg-",
+ "default_timezone" => "Etc/UTC"
);
/* IP TOS flags */
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc
index 34002ff..d172810 100644
--- a/src/etc/inc/system.inc
+++ b/src/etc/inc/system.inc
@@ -1498,6 +1498,18 @@ EOD;
}
+function system_get_timezone_list() {
+ global $g;
+
+ $file_list = glob("/usr/share/zoneinfo/*/*");
+
+ if (empty($file_list)) {
+ $file_list[] = $g['default_timezone'];
+ }
+
+ return str_replace('/usr/share/zoneinfo/', '', $file_list);
+}
+
function system_timezone_configure() {
global $config, $g;
if (isset($config['system']['developerspew'])) {
@@ -1512,28 +1524,11 @@ function system_timezone_configure() {
}
/* extract appropriate timezone file */
- $timezone = $syscfg['timezone'];
- if ($timezone) {
- exec('/usr/bin/tar -tvzf /usr/share/zoneinfo.tgz', $tzs);
- foreach ($tzs as $tz) {
- if (preg_match(",{$timezone}$,", $tz)) {
- break;
- }
- if (preg_match(",{$timezone} link to *(.*)$,", $tz, $matches)) {
- $timezone = $matches[1];
- break;
- }
- }
- } else {
- $timezone = "Etc/UTC";
- }
-
+ $timezone = (isset($syscfg['timezone']) ? $syscfg['timezone'] : $g['default_timezone']);
conf_mount_rw();
-
- exec("LANG=C /usr/bin/tar xzfO /usr/share/zoneinfo.tgz " .
- escapeshellarg($timezone) . " > /etc/localtime");
-
- mwexec("sync");
+ /* DO NOT remove \n otherwise tzseup will fail */
+ @file_put_contents("/var/db/zoneinfo", $timezone . "\n");
+ mwexec("/usr/sbin/tzsetup -r");
conf_mount_ro();
if (platform_booting()) {
diff --git a/src/etc/pfSense.obsoletedfiles b/src/etc/pfSense.obsoletedfiles
index e0fcce8..6da07a9 100644
--- a/src/etc/pfSense.obsoletedfiles
+++ b/src/etc/pfSense.obsoletedfiles
@@ -957,7 +957,7 @@
/usr/share/nls/POSIX/ee.cat
/usr/share/nls/en_US.US-ASCII/ee.cat
/usr/share/syscons
-/usr/share/zoneinfo/GMT
+/usr/share/zoneinfo.tgz
/var/db/dhclient.leases.sis1
/var/db/rrd/71
/var/db/rrd/index.html
diff --git a/src/usr/local/www/system.php b/src/usr/local/www/system.php
index c848f52..4827d18 100644
--- a/src/usr/local/www/system.php
+++ b/src/usr/local/www/system.php
@@ -72,6 +72,7 @@ require("guiconfig.inc");
require_once("functions.inc");
require_once("filter.inc");
require_once("shaper.inc");
+require_once("system.inc");
$pconfig['hostname'] = $config['system']['hostname'];
$pconfig['domain'] = $config['system']['domain'];
@@ -114,9 +115,7 @@ if ($pconfig['timezone'] <> $_POST['timezone']) {
filter_pflog_start(true);
}
-exec('/usr/bin/tar -tzf /usr/share/zoneinfo.tgz', $timezonelist);
-$timezonelist = array_filter($timezonelist, 'is_timezone');
-sort($timezonelist);
+$timezonelist = system_get_timezone_list();
$multiwan = false;
$interfaces = get_configured_interface_list();
@@ -456,4 +455,4 @@ $form->add($section);
print $form;
-include("foot.inc"); \ No newline at end of file
+include("foot.inc");
diff --git a/src/usr/local/www/wizard.php b/src/usr/local/www/wizard.php
index 4273b76..90d60e5 100644
--- a/src/usr/local/www/wizard.php
+++ b/src/usr/local/www/wizard.php
@@ -68,6 +68,7 @@ require("functions.inc");
require_once("filter.inc");
require("shaper.inc");
require_once("rrd.inc");
+require_once("system.inc");
function gentitle_pkg($pgname) {
global $config;
@@ -822,9 +823,7 @@ if ($pkg['step'][$stepid]['fields']['field'] != "") {
break;
case "timezone_select":
- exec('/usr/bin/tar -tzf /usr/share/zoneinfo.tgz', $timezonelist);
- $timezonelist = array_filter($timezonelist, 'is_timezone');
- sort($timezonelist);
+ $timezonelist = system_get_timezone_list();
/* kill carriage returns */
for ($x = 0; $x < count($timezonelist); $x++) {
diff --git a/src/usr/share/zoneinfo.tgz b/src/usr/share/zoneinfo.tgz
deleted file mode 100644
index 410a41f..0000000
--- a/src/usr/share/zoneinfo.tgz
+++ /dev/null
Binary files differ
OpenPOWER on IntegriCloud