From 1afe55bd5f68205645d16a32b56cef2af4f3bb7f Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Fri, 24 May 2024 14:59:23 +0200 Subject: fix: address review 2 Signed-off-by: Simon L --- console.php | 3 ++- cron.php | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/console.php b/console.php index 355b62ca2e6..b2bc50c13d0 100644 --- a/console.php +++ b/console.php @@ -43,12 +43,13 @@ try { $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; diff --git a/cron.php b/cron.php index 9f2c7288589..d36ab67c650 100644 --- a/cron.php +++ b/cron.php @@ -131,12 +131,13 @@ Options: $user = posix_getuid(); $userNameArray = posix_getpwuid($user); - if ($userNameArray !== false)) { + $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; -- cgit v1.2.3