From 7a1aba66b98a13fbe3f06739da42844c2ee8ae00 Mon Sep 17 00:00:00 2001 From: "lambroslambrou@google.com" Date: Tue, 10 Jan 2012 18:04:24 +0000 Subject: Fix permissions of log file. Also fix usage of umask to be consistent for auth and host configs. BUG=None TEST=Manual Review URL: http://codereview.chromium.org/9117004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117051 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/tools/me2me_virtual_host.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'remoting/tools') diff --git a/remoting/tools/me2me_virtual_host.py b/remoting/tools/me2me_virtual_host.py index 2d28a5b..99195b4 100755 --- a/remoting/tools/me2me_virtual_host.py +++ b/remoting/tools/me2me_virtual_host.py @@ -186,10 +186,11 @@ class Host: "host_name": self.host_name, "private_key": self.private_key, } - os.umask(0066) # Set permission mask for created file. + old_umask = os.umask(0066) settings_file = open(self.config_file, 'w') settings_file.write(json.dumps(data, indent=2)) settings_file.close() + os.umask(old_umask) class Desktop: @@ -374,8 +375,11 @@ def daemonize(log_filename): # Create new (temporary) file-descriptors before forking, so any errors get # reported to the main process and set the correct exit-code. + # The mode is provided, since Python otherwise sets a default mode of 0777, + # which would result in the new file having permissions of 0777 & ~umask, + # possibly leaving the executable bits set. devnull_fd = os.open(os.devnull, os.O_RDONLY) - log_fd = os.open(log_filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC) + log_fd = os.open(log_filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0600) pid = os.fork() -- cgit v1.1