From 51542a51f48d35a0cf5353111f22cc4f75fe1ec1 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Fri, 23 Oct 2009 18:36:42 +0000 Subject: [PATCH] * (bug 21172) $wgSorbsUrl can now be an array with multiple DNSBL --- RELEASE-NOTES | 1 + includes/DefaultSettings.php | 8 ++++++-- includes/User.php | 25 ++++++++++++++----------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a676933641..c592bc51d4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -90,6 +90,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * New hook AbortNewAccountAuto, called before account creation from AuthPlugin- or ExtUser-driven requests. * $wgCapitalLinkOverrides added to configure per-namespace capitalization +* (bug 21172) $wgSorbsUrl can now be an array with multiple DNSBL === New features in 1.16 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index ec2d017aa1..ef0166aec3 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3531,10 +3531,14 @@ $wgDisableHardRedirects = false; $wgEnableTooltipsAndAccesskeys = true; /** - * Use http.dnsbl.sorbs.net to check for open proxies + * Whether to use DNS blacklists in $wgSorbsUrl to check for open proxies */ $wgEnableSorbs = false; -$wgSorbsUrl = 'http.dnsbl.sorbs.net.'; + +/** + * List of DNS blacklists to use, if $wgEnableSorbs is true + */ +$wgSorbsUrl = array( 'http.dnsbl.sorbs.net.' ); /** * Proxy whitelist, list of addresses that are assumed to be non-proxy despite diff --git a/includes/User.php b/includes/User.php index daab4539be..7767bb41db 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1185,10 +1185,10 @@ class User { * Whether the given IP is in a given DNS blacklist. * * @param $ip \string IP to check - * @param $base \string URL of the DNS blacklist + * @param $bases \string or Array of Strings: URL of the DNS blacklist * @return \bool True if blacklisted. */ - function inDnsBlacklist( $ip, $base ) { + function inDnsBlacklist( $ip, $bases ) { wfProfileIn( __METHOD__ ); $found = false; @@ -1198,17 +1198,20 @@ class User { # Reverse IP, bug 21255 $ipReversed = implode( '.', array_reverse( explode( '.', $ip ) ) ); - # Make hostname - $host = "$ipReversed.$base"; + foreach( (array)$bases as $base ) { + # Make hostname + $host = "$ipReversed.$base"; - # Send query - $ipList = gethostbynamel( $host ); + # Send query + $ipList = gethostbynamel( $host ); - if( $ipList ) { - wfDebug( "Hostname $host is {$ipList[0]}, it's a proxy says $base!\n" ); - $found = true; - } else { - wfDebug( "Requested $host, not found in $base.\n" ); + if( $ipList ) { + wfDebug( "Hostname $host is {$ipList[0]}, it's a proxy says $base!\n" ); + $found = true; + break; + } else { + wfDebug( "Requested $host, not found in $base.\n" ); + } } } -- 2.20.1