r58061 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58060‎ | r58061 | r58062 >
Date:18:36, 23 October 2009
Author:ialex
Status:resolved (Comments)
Tags:
Comment:
* (bug 21172) $wgSorbsUrl can now be an array with multiple DNSBL
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -1185,10 +1185,10 @@
11861186 * Whether the given IP is in a given DNS blacklist.
11871187 *
11881188 * @param $ip \string IP to check
1189 - * @param $base \string URL of the DNS blacklist
 1189+ * @param $bases \string or Array of Strings: URL of the DNS blacklist
11901190 * @return \bool True if blacklisted.
11911191 */
1192 - function inDnsBlacklist( $ip, $base ) {
 1192+ function inDnsBlacklist( $ip, $bases ) {
11931193 wfProfileIn( __METHOD__ );
11941194
11951195 $found = false;
@@ -1198,17 +1198,20 @@
11991199 # Reverse IP, bug 21255
12001200 $ipReversed = implode( '.', array_reverse( explode( '.', $ip ) ) );
12011201
1202 - # Make hostname
1203 - $host = "$ipReversed.$base";
 1202+ foreach( (array)$bases as $base ) {
 1203+ # Make hostname
 1204+ $host = "$ipReversed.$base";
12041205
1205 - # Send query
1206 - $ipList = gethostbynamel( $host );
 1206+ # Send query
 1207+ $ipList = gethostbynamel( $host );
12071208
1208 - if( $ipList ) {
1209 - wfDebug( "Hostname $host is {$ipList[0]}, it's a proxy says $base!\n" );
1210 - $found = true;
1211 - } else {
1212 - wfDebug( "Requested $host, not found in $base.\n" );
 1209+ if( $ipList ) {
 1210+ wfDebug( "Hostname $host is {$ipList[0]}, it's a proxy says $base!\n" );
 1211+ $found = true;
 1212+ break;
 1213+ } else {
 1214+ wfDebug( "Requested $host, not found in $base.\n" );
 1215+ }
12131216 }
12141217 }
12151218
Index: trunk/phase3/includes/DefaultSettings.php
@@ -3531,12 +3531,16 @@
35323532 $wgEnableTooltipsAndAccesskeys = true;
35333533
35343534 /**
3535 - * Use http.dnsbl.sorbs.net to check for open proxies
 3535+ * Whether to use DNS blacklists in $wgSorbsUrl to check for open proxies
35363536 */
35373537 $wgEnableSorbs = false;
3538 -$wgSorbsUrl = 'http.dnsbl.sorbs.net.';
35393538
35403539 /**
 3540+ * List of DNS blacklists to use, if $wgEnableSorbs is true
 3541+ */
 3542+$wgSorbsUrl = array( 'http.dnsbl.sorbs.net.' );
 3543+
 3544+/**
35413545 * Proxy whitelist, list of addresses that are assumed to be non-proxy despite
35423546 * what the other methods might say.
35433547 */
Index: trunk/phase3/RELEASE-NOTES
@@ -90,6 +90,7 @@
9191 * New hook AbortNewAccountAuto, called before account creation from AuthPlugin-
9292 or ExtUser-driven requests.
9393 * $wgCapitalLinkOverrides added to configure per-namespace capitalization
 94+* (bug 21172) $wgSorbsUrl can now be an array with multiple DNSBL
9495
9596 === New features in 1.16 ===
9697

Follow-up revisions

RevisionCommit summaryAuthorDate
r60506Per Tim Starling, fixes for r58061:...ialex12:32, 30 December 2009

Comments

#Comment by Tim Starling (talk | contribs)   07:29, 17 December 2009

Please rename the variable if it has nothing to do with SORBS anymore. This extension to the format seems to be solely intended to allow non-SORBS DNSBLs to be listed. The old variable name could be kept for backwards-compatibility. Really it should have been fixed in r17528 but it's not too late.

#Comment by IAlex (talk | contribs)   12:33, 30 December 2009

Done in r60506.

Status & tagging log