[Pkg-owncloud-commits] [owncloud] 05/103: Cron has to be executed with the correct user - fixes 13912 and others
David Prévot
taffit at moszumanska.debian.org
Sun May 31 12:32:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v8.0.4RC1
in repository owncloud.
commit 4905a4cd4af1fbe3d55ee8136aed4bb216e50a8b
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date: Wed Apr 1 10:31:48 2015 +0200
Cron has to be executed with the correct user - fixes 13912 and others
---
cron.php | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/cron.php b/cron.php
index ef68669..9112bdf 100644
--- a/cron.php
+++ b/cron.php
@@ -90,6 +90,22 @@ try {
}
if (OC::$CLI) {
+ // the cron job must be executed with the right user
+ if (!OC_Util::runningOnWindows()) {
+ if (!function_exists('posix_getuid')) {
+ echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL;
+ exit(0);
+ }
+ $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);
+ }
+ }
+
// Create lock file first
TemporaryCronClass::$lockfile = OC_Config::getValue("datadirectory", OC::$SERVERROOT . '/data') . '/cron.lock';
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list