[pve-devel] r5495 - pve-common/trunk/data/PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Feb 9 08:58:38 CET 2011


Author: dietmar
Date: 2011-02-09 08:58:37 +0100 (Wed, 09 Feb 2011)
New Revision: 5495

Modified:
   pve-common/trunk/data/PVE/INotify.pm
Log:
verify timezone


Modified: pve-common/trunk/data/PVE/INotify.pm
===================================================================
--- pve-common/trunk/data/PVE/INotify.pm	2011-02-09 05:55:55 UTC (rev 5494)
+++ pve-common/trunk/data/PVE/INotify.pm	2011-02-09 07:58:37 UTC (rev 5495)
@@ -10,6 +10,7 @@
 use File::Basename;
 use Fcntl qw(:DEFAULT :flock);
 use PVE::SafeSyslog;
+use PVE::Exception qw(raise_param_exc);
 use PVE::Tools;
 use Storable qw(dclone);            
 use Linux::Inotify2;
@@ -588,12 +589,18 @@
 sub write_etc_timezone {
     my ($filename, $fh, $timezone) = @_;
 
+    my $tzinfo = "/usr/share/zoneinfo/$timezone";
+
+    raise_param_exc({ 'timezone' => "No such timezone" })
+	if (! -f $tzinfo);
+
+    ($timezone) = $timezone =~ m/^(.*)$/; # untaint
+
     print $fh "$timezone\n";
 
     unlink ("/etc/localtime");
     symlink ("/usr/share/zoneinfo/$timezone", "/etc/localtime");
 
-    return $timezone;
 }
 
 register_file('timezone', "/etc/timezone", 




More information about the pve-devel mailing list