Issue #184: Backports for SA-CORE-2012-002.

Pull request for https://github.com/backdrop/backdrop-issues/issues/184, including security fixes included in Drupal 7.13.