From 793e1e8d6eb3d728715e2fbf9c38e90e1f874d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 12 Jan 2015 16:49:36 +0100 Subject: [PATCH] Check for current user to have the same id then the owner of the config file - fixes #12307 --- console.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/console.php b/console.php index 4b0adae539..f6fba14b7f 100644 --- a/console.php +++ b/console.php @@ -22,6 +22,17 @@ try { exit(0); } + if (!OC_Util::runningOnWindows()) { + $user = posix_getpwuid(posix_getuid()); + $configUser = posix_getpwuid(fileowner(OC::$SERVERROOT . '/config/config.php')); + if ($user['name'] !== $configUser['name']) { + echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL; + echo "Current user: " . $user['name'] . PHP_EOL; + echo "Web server user: " . $configUser['name'] . PHP_EOL; + exit(0); + } + } + // only load apps if no update is due, // else only core commands will be available if (!\OCP\Util::needUpgrade()) {