Revert r51725 (fall back to 127.0.0.1 when IP cannot be determined). On further discu...
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 12 Jun 2009 01:34:44 +0000 (01:34 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 12 Jun 2009 01:34:44 +0000 (01:34 +0000)
RELEASE-NOTES
includes/ProxyTools.php

index 7e3b443..489870b 100644 (file)
@@ -182,8 +182,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * 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 ==
 
index 7331d74..dc30d0e 100644 (file)
@@ -76,13 +76,14 @@ function wfGetIP() {
 
        /* 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'] );
+       }
+       if( $ip ) {
+               $ipchain[] = $ip;
        }
-       $ip = $ipchain[0];
+       
+       $ip = false;
 
        # Append XFF on to $ipchain
        $forwardedFor = wfGetForwardedFor();
@@ -107,6 +108,10 @@ function wfGetIP() {
                }
        }
 
+       if( $ip ) {
+               throw new MWException( "Unable to determine IP" );
+       }
+
        wfDebug( "IP: $ip\n" );
        $wgIP = $ip;
        return $ip;