From 913c238080d0f52264758d7ecdc4f22786bac00f Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sun, 29 May 2005 04:44:13 +0000 Subject: [PATCH] Ported proxy whitelist from REL1_4, also fixed broken $bFromSlave parameter (untested) --- includes/DefaultSettings.php | 6 ++++++ includes/User.php | 21 +++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 4cb9f4554c..c552e2211f 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1422,6 +1422,12 @@ $wgEnableSorbs = false; */ $wgEnableOpm = false; +/** + * Proxy whitelist, list of addresses that are assumed to be non-proxy despite what the other + * methods might say + */ +$wgProxyWhitelist = array(); + /** * Simple rate limiter options to brake edit floods. * Maximum number actions allowed in the given number of seconds; diff --git a/includes/User.php b/includes/User.php index 7d637cbe4d..a1659471a6 100644 --- a/includes/User.php +++ b/includes/User.php @@ -291,8 +291,8 @@ class User { * just slightly outta sync and soon corrected - safer to block slightly more that less. * And it's cheaper to check slave first, then master if needed, than master always. */ - function getBlockedStatus() { - global $wgIP, $wgBlockCache, $wgProxyList, $wgEnableSorbs, $bFromSlave; + function getBlockedStatus( $bFromSlave = true ) { + global $wgIP, $wgBlockCache, $wgProxyList, $wgEnableSorbs, $wgProxyWhitelist; if ( -1 != $this->mBlockedby ) { return; } @@ -326,21 +326,22 @@ class User { } # Proxy blocking - if ( !$this->mBlockedby ) { + if ( !$this->isSysop() && !in_array( $wgIP, $wgProxyWhitelist ) ) { + + # Local list if ( array_key_exists( $wgIP, $wgProxyList ) ) { $this->mBlockedby = wfMsg( 'proxyblocker' ); $this->mBlockreason = wfMsg( 'proxyblockreason' ); } - } - # DNSBL - if ( !$this->mBlockedby && $wgEnableSorbs ) { - if ( $this->inSorbsBlacklist( $wgIP ) ) { - $this->mBlockedby = wfMsg( 'sorbs' ); - $this->mBlockreason = wfMsg( 'sorbsreason' ); + # DNSBL + if ( !$this->mBlockedby && $wgEnableSorbs ) { + if ( $this->inSorbsBlacklist( $wgIP ) ) { + $this->mBlockedby = wfMsg( 'sorbs' ); + $this->mBlockreason = wfMsg( 'sorbsreason' ); + } } } - } function inSorbsBlacklist( $ip ) { -- 2.20.1