set correct umask to create user config in installation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -332,8 +332,9 @@ class FroxlorInstall
|
|||||||
$userdata .= "?>";
|
$userdata .= "?>";
|
||||||
|
|
||||||
// test if we can store the userdata.inc.php in ../lib
|
// test if we can store the userdata.inc.php in ../lib
|
||||||
|
$umask = @umask(077);
|
||||||
$userdata_file = dirname(dirname(dirname(__FILE__))) . '/lib/userdata.inc.php';
|
$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');
|
$fp = @fopen($userdata_file, 'w');
|
||||||
@fputs($fp, $userdata, strlen($userdata));
|
@fputs($fp, $userdata, strlen($userdata));
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
@@ -343,7 +344,6 @@ class FroxlorInstall
|
|||||||
// try creating it in a temporary file
|
// try creating it in a temporary file
|
||||||
$temp_file = @tempnam(sys_get_temp_dir(), 'fx');
|
$temp_file = @tempnam(sys_get_temp_dir(), 'fx');
|
||||||
if ($temp_file) {
|
if ($temp_file) {
|
||||||
chmod($temp_file, 0600);
|
|
||||||
$fp = @fopen($temp_file, 'w');
|
$fp = @fopen($temp_file, 'w');
|
||||||
@fputs($fp, $userdata, strlen($userdata));
|
@fputs($fp, $userdata, strlen($userdata));
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
@@ -354,6 +354,7 @@ class FroxlorInstall
|
|||||||
eval("\$content .= \"" . $this->_getTemplate("textarea") . "\";");
|
eval("\$content .= \"" . $this->_getTemplate("textarea") . "\";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@umask($umask);
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user