From 02c5f808546f4350c6754e7b61bf735688082435 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Sun, 8 Mar 2020 07:35:19 +0100 Subject: [PATCH] correct chmod value for userdata.inc.php file to be written on installation; fixes #815 Signed-off-by: Michael Kaufmann --- customer_email.php | 1 - install/lib/class.FroxlorInstall.php | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/customer_email.php b/customer_email.php index 3e8bd67e..8a9902de 100644 --- a/customer_email.php +++ b/customer_email.php @@ -19,7 +19,6 @@ define('AREA', 'customer'); require './lib/init.php'; -use Froxlor\Api\Commands\SubDomains; use Froxlor\Database\Database; use Froxlor\Settings; use Froxlor\Api\Commands\Emails as Emails; diff --git a/install/lib/class.FroxlorInstall.php b/install/lib/class.FroxlorInstall.php index 4884a87e..c00ebe85 100644 --- a/install/lib/class.FroxlorInstall.php +++ b/install/lib/class.FroxlorInstall.php @@ -333,16 +333,17 @@ class FroxlorInstall // test if we can store the userdata.inc.php in ../lib $userdata_file = dirname(dirname(dirname(__FILE__))) . '/lib/userdata.inc.php'; - if (@touch($userdata_file) && @chmod($userdata_file, 0400) && @is_writable($userdata_file)) { + if (@touch($userdata_file) && @chmod($userdata_file, 0600) && @is_writable($userdata_file)) { $fp = @fopen($userdata_file, 'w'); @fputs($fp, $userdata, strlen($userdata)); @fclose($fp); $content .= $this->_status_message('green', 'OK'); } else { + @unlink($userdata_file); // try creating it in a temporary file $temp_file = @tempnam(sys_get_temp_dir(), 'fx'); if ($temp_file) { - chmod($temp_file, 0400); + chmod($temp_file, 0600); $fp = @fopen($temp_file, 'w'); @fputs($fp, $userdata, strlen($userdata)); @fclose($fp);