* (bug 21172) $wgSorbsUrl can now be an array with multiple DNSBL
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 23 Oct 2009 18:36:42 +0000 (18:36 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 23 Oct 2009 18:36:42 +0000 (18:36 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/User.php

index a676933..c592bc5 100644 (file)
@@ -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 ===
 
index ec2d017..ef0166a 100644 (file)
@@ -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
index daab453..7767bb4 100644 (file)
@@ -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" );
+                               }
                        }
                }