Heine

  • home
  • drupal
  • drupal core commits
  • about
Home › Drupal Core Commits

Commit 340626 by dries

- Patch #431776 by catch, agentrickard, Damien Tournoud, Dries: cron should run as anonymous when invoked via the run-cron link on the status report page.

--- <a href="http://drupalcode.org/viewvc/drupal/drupal/includes/common.inc" title="http://drupalcode.org/viewvc/drupal/drupal/includes/common.inc" rel="nofollow">http://drupalcode.org/viewvc/drupal/drupal/includes/common.inc</a>   2010/03/11 21:23:05     1.1127
+++ <a href="http://drupalcode.org/viewvc/drupal/drupal/includes/common.inc" title="http://drupalcode.org/viewvc/drupal/drupal/includes/common.inc" rel="nofollow">http://drupalcode.org/viewvc/drupal/drupal/includes/common.inc</a>   2010/03/12 14:20:32     1.1128
@@ -4385,6 +4385,14 @@
   // Allow execution to continue even if the request gets canceled.
   @ignore_user_abort(TRUE);
 
+  // Prevent session information from being saved while cron is running.
+  drupal_save_session(FALSE);
+
+  // Force the current user to anonymous to ensure consistent permissions on
+  // cron runs.
+  $original_user = $GLOBALS['user'];
+  $GLOBALS['user'] = drupal_anonymous_user();
+
   // Try to allocate enough time to run all the hook_cron implementations.
   drupal_set_time_limit(240);
 
@@ -4445,6 +4453,10 @@
       $queue->deleteItem($item);
     }
   }
+  // Restore the user.
+  $GLOBALS['user'] = $original_user;
+  drupal_save_session(TRUE);
+
   return $return;
 }
 

No votes yet
  • Drupal Core
  • Download patch

Recent posts

  • Planet Drupal past and current
  • Help! - Cannot access a global variable.
  • Why is my module's update hook not listed on update.php's selection form?
  • How do I add a class to a link generated with l()
  • ZeroDayScan - Full path disclosure bug in Drupal 6.16 (0day)
more

Security reviews

  • Afraid custom code makes your site vulnerable?
  • You don't really trust that module you just downloaded from Drupal.org?

Sleep better after a security review.

Tags

Captcha CSRF Drupal embed Input Format modx OpenID Performance Planet Drupal rants Security Varnish
more tags
  • home
  • drupal
  • drupal core commits
  • about

Copyright © 2010 by Heine Deelstra. All rights reserved.