Revision: 51774 Author: demon Date: 2009-06-12 01:34:44 +0000 (Fri, 12 Jun 2009)
Log Message: ----------- Revert r51725 (fall back to 127.0.0.1 when IP cannot be determined). On further discussion, it's best if we don't make up a fake IP. Tweak the logic here a bit (per Tim) to let XFF attempt to determine the actual IP. Throw an exception if we can't. Modified Paths: -------------- trunk/phase3/RELEASE-NOTES trunk/phase3/includes/ProxyTools.php Modified: trunk/phase3/RELEASE-NOTES =================================================================== --- trunk/phase3/RELEASE-NOTES 2009-06-12 00:09:15 UTC (rev 51773) +++ trunk/phase3/RELEASE-NOTES 2009-06-12 01:34:44 UTC (rev 51774) @@ -182,8 +182,7 @@ * Multiple whitespace in TOC anchors is now stripped, for consistency with the link from the edit comment * (bug 19112) Preferences now respects $wgUseExternalEditor, $wgExternalDiffEngine -* (bug 18173) Login form exception on malformed REMOTE_ADDR, wfGetIP() now falls - back to 127.0.0.1 if the IP cannot be determined +* (bug 18173) MediaWiki now fails on malformed REMOTE_ADDR == API changes in 1.16 == Modified: trunk/phase3/includes/ProxyTools.php =================================================================== --- trunk/phase3/includes/ProxyTools.php 2009-06-12 00:09:15 UTC (rev 51773) +++ trunk/phase3/includes/ProxyTools.php 2009-06-12 01:34:44 UTC (rev 51774) @@ -76,13 +76,14 @@ /* collect the originating ips */ # Client connecting to this webserver - if ( isset( $_SERVER['REMOTE_ADDR'] ) && IP::canonicalize( $_SERVER['REMOTE_ADDR'] ) ) { - $ipchain = array( IP::canonicalize( $_SERVER['REMOTE_ADDR'] ) ); - } else { - # Running on CLI or REMOTE_ADDR is broken - $ipchain = array( '127.0.0.1' ); + if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { + $ip = IP::canonicalize( $_SERVER['REMOTE_ADDR'] ); } - $ip = $ipchain[0]; + if( $ip ) { + $ipchain[] = $ip; + } + + $ip = false; # Append XFF on to $ipchain $forwardedFor = wfGetForwardedFor(); @@ -107,6 +108,10 @@ } } + if( $ip ) { + throw new MWException( "Unable to determine IP" ); + } + wfDebug( "IP: $ip\n" ); $wgIP = $ip; return $ip; _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs