* (bug 21255) Fixed hostname construction for DNSBL checking
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 23 Oct 2009 16:44:10 +0000 (16:44 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 23 Oct 2009 16:44:10 +0000 (16:44 +0000)
Based on a patch by Antonio Ospite - http://bug-attachment.wikimedia.org/attachment.cgi?id=6707

CREDITS
RELEASE-NOTES
includes/User.php

diff --git a/CREDITS b/CREDITS
index 549c8d0..86a1e3e 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -59,6 +59,7 @@ following names for their contribution to the product.
 == Patch Contributors ==
 * Agbad
 * Ahmad Sherif
+* Antonio Ospite
 * Azliq7
 * Borislav Manolov
 * Brad Jorsch
index 1a402e9..a676933 100644 (file)
@@ -589,6 +589,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 21234) Moving subpages of titles containing \\ now works properly
 * (bug 21006) maintenance/updateArticleCount.php now works again on PostgreSQL
 * (bug 19319) Add activeusers-intro message at top of SpecialActiveUsers page
+* (bug 21255) Fixed hostname construction for DNSBL checking
 
 == API changes in 1.16 ==
 
index fd97f3b..daab453 100644 (file)
@@ -1195,8 +1195,11 @@ class User {
                $host = '';
                // FIXME: IPv6 ???  (http://bugs.php.net/bug.php?id=33170)
                if( IP::isIPv4( $ip ) ) {
+                       # Reverse IP, bug 21255
+                       $ipReversed = implode( '.', array_reverse( explode( '.', $ip ) ) );
+
                        # Make hostname
-                       $host = "$ip.$base";
+                       $host = "$ipReversed.$base";
 
                        # Send query
                        $ipList = gethostbynamel( $host );