force runcron to be run by the right user

This commit is contained in:
following
2013-06-11 20:30:43 +02:00
parent 53678a8cb5
commit 51c4629eed
2 changed files with 9 additions and 3 deletions
+1
View File
@@ -406,6 +406,7 @@
/* cronjob
*/
$opt['cron']['pidfile'] = $opt['rootpath'] . 'cache2/runcron.pid';
$opt['cron']['username'] = 'apache'; // system username for cronjobs
/* phpbb news integration (index.php)
*
+6 -1
View File
@@ -18,6 +18,11 @@
require($opt['rootpath'] . 'lib2/cli.inc.php');
// test for user who runs the cronjob
$processUser = posix_getpwuid(posix_geteuid());
if ($processUser['name'] != $opt['cron']['username'])
die("ERROR: runcron must be run by '" . $opt['cron']['username'] . "' but was called by '" . $processUser['name'] . "'\n");
// use posix pid-files to lock process
if (!CreatePidFile($opt['cron']['pidfile']))
{
@@ -29,7 +34,7 @@
// This is relevant e.g. for publishing and for auto-archiving caches.
if ($opt['logic']['systemuser']['user'] != '')
if (!$login->system_login($opt['logic']['systemuser']['user']))
die("runcron: system user login failed");
die("ERROR: runcron system user login failed");
$modules_dir = $opt['rootpath'] . 'util2/cron/modules/';