aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon L. <szaimen@e.mail.de>2024-05-24 14:59:23 +0200
committerSimon L. <szaimen@e.mail.de>2024-05-24 15:00:10 +0200
commit1afe55bd5f68205645d16a32b56cef2af4f3bb7f (patch)
tree70d559fbeb42da2ba4a8fbb0bc727118bb3dabdf
parent137986f30d178cf15a4ded25e906df0e130560dd (diff)
downloadnextcloud-server-enh/noid/allow-configure-config.owner.tar.gz
nextcloud-server-enh/noid/allow-configure-config.owner.zip
Signed-off-by: Simon L <szaimen@e.mail.de>
-rw-r--r--console.php3
-rw-r--r--cron.php5
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;