From 09c00438a6410ac51825e33eddd9bc0897a1ddbf Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Sun, 14 Feb 2016 21:13:48 -0500 Subject: [PATCH] Use global cache keys login/create account rate limitting If you are running multiple wikis, you probably want the rate limit on one wiki to apply to all wikis Bug: T126685 Change-Id: Id662742c7af1b26811f5b0aa199176cb9a7658d9 --- includes/specials/SpecialUserlogin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 05e5229867..0273484496 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -649,7 +649,7 @@ class LoginForm extends SpecialPage { "allowed account creation w/o throttle\n" ); } else { if ( ( $wgAccountCreationThrottle && $currentUser->isPingLimitable() ) ) { - $key = wfMemcKey( 'acctcreate', 'ip', $ip ); + $key = wfGlobalCacheKey( 'acctcreate', 'ip', $ip ); $value = $cache->get( $key ); if ( !$value ) { $cache->set( $key, 0, $cache::TTL_DAY ); @@ -890,7 +890,7 @@ class LoginForm extends SpecialPage { $throttleCount = 0; if ( is_array( $wgPasswordAttemptThrottle ) ) { - $throttleKey = wfMemcKey( 'password-throttle', $wgRequest->getIP(), md5( $username ) ); + $throttleKey = wfGlobalCacheKey( 'password-throttle', $wgRequest->getIP(), md5( $username ) ); $count = $wgPasswordAttemptThrottle['count']; $period = $wgPasswordAttemptThrottle['seconds']; @@ -917,7 +917,7 @@ class LoginForm extends SpecialPage { global $wgRequest; $username = trim( $username ); // sanity - $throttleKey = wfMemcKey( 'password-throttle', $wgRequest->getIP(), md5( $username ) ); + $throttleKey = wfGlobalCacheKey( 'password-throttle', $wgRequest->getIP(), md5( $username ) ); ObjectCache::getLocalClusterInstance()->delete( $throttleKey ); } @@ -1000,7 +1000,7 @@ class LoginForm extends SpecialPage { // Reset the throttle $request = $this->getRequest(); - $key = wfMemcKey( 'password-throttle', $request->getIP(), md5( $this->mUsername ) ); + $key = wfGlobalCacheKey( 'password-throttle', $request->getIP(), md5( $this->mUsername ) ); $cache->delete( $key ); if ( $this->hasSessionCookie() || $this->mSkipCookieCheck ) { -- 2.20.1