From a46e7a3bc4cf89e7fdbbcaf03c8c1f8a75c7a573 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Tue, 10 Mar 2020 07:48:35 +0100 Subject: [PATCH] set correct umask to create user config in installation Signed-off-by: Michael Kaufmann --- install/lib/class.FroxlorInstall.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install/lib/class.FroxlorInstall.php b/install/lib/class.FroxlorInstall.php index c00ebe85..33dc8434 100644 --- a/install/lib/class.FroxlorInstall.php +++ b/install/lib/class.FroxlorInstall.php @@ -332,8 +332,9 @@ class FroxlorInstall $userdata .= "?>"; // test if we can store the userdata.inc.php in ../lib + $umask = @umask(077); $userdata_file = dirname(dirname(dirname(__FILE__))) . '/lib/userdata.inc.php'; - if (@touch($userdata_file) && @chmod($userdata_file, 0600) && @is_writable($userdata_file)) { + if (@touch($userdata_file) && @is_writable($userdata_file)) { $fp = @fopen($userdata_file, 'w'); @fputs($fp, $userdata, strlen($userdata)); @fclose($fp); @@ -343,7 +344,6 @@ class FroxlorInstall // try creating it in a temporary file $temp_file = @tempnam(sys_get_temp_dir(), 'fx'); if ($temp_file) { - chmod($temp_file, 0600); $fp = @fopen($temp_file, 'w'); @fputs($fp, $userdata, strlen($userdata)); @fclose($fp); @@ -354,6 +354,7 @@ class FroxlorInstall eval("\$content .= \"" . $this->_getTemplate("textarea") . "\";"); } } + @umask($umask); return $content; }