Skip to content

Commit

Permalink
fix: address review 2
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <szaimen@e.mail.de>
  • Loading branch information
szaimen committed May 24, 2024
1 parent 137986f commit 9281f6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion console.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ function exceptionHandler($exception) {

$user = posix_getuid();
$userNameArray = posix_getpwuid($user);
$username = null;
if ($userNameArray !== false) {
$userName = $userNameArray['name'];
}
$configUser = fileowner(OC::$configDir . 'config.php');
$configuredUser = $config->getSystemValueString('php.user', '');
if ($user !== $configUser && $userName !== $configuredUser) {
if ($user !== $configUser && $username !== null && $userName !== $configuredUser) {
echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
echo "Current user id: " . $user . PHP_EOL;
echo "Owner id of config.php: " . $configUser . PHP_EOL;
Expand Down
3 changes: 2 additions & 1 deletion cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,13 @@

$user = posix_getuid();
$userNameArray = posix_getpwuid($user);
$username = null;
if ($userNameArray !== false)) {
$userName = $userNameArray['name'];
}
$configUser = fileowner(OC::$configDir . 'config.php');
$configuredUser = $config->getSystemValueString('php.user', '');
if ($user !== $configUser && $userName !== $configuredUser) {
if ($user !== $configUser && $username !== null && $userName !== $configuredUser) {
echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
echo "Current user id: " . $user . PHP_EOL;
echo "Owner id of config.php: " . $configUser . PHP_EOL;
Expand Down

0 comments on commit 9281f6f

Please sign in to comment.