Added a new configuration option ($wgUsePrivateIPs) to force MediaWiki to use forward...
authorCharles Melbye <charlie@users.mediawiki.org>
Thu, 20 Nov 2008 23:30:08 +0000 (23:30 +0000)
committerCharles Melbye <charlie@users.mediawiki.org>
Thu, 20 Nov 2008 23:30:08 +0000 (23:30 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/ProxyTools.php

index 2337e54..d06dd2d 100644 (file)
@@ -63,6 +63,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Image namespace and accompanying talk namespace renamed to File. For backward
   compatibility purposes, Image still works. External tools may need to be
   updated.
+* MediaWiki can be forced to use private IPs forwarded by a proxy server by
+  using $wgUsePrivateIPs.
 
 === Migrated extensions ===
 The following extensions are migrated into MediaWiki 1.14:
index 32c04fc..154b7d6 100644 (file)
@@ -1590,6 +1590,9 @@ $wgHTCPMulticastTTL = 1;
 # $wgHTCPMulticastAddress = "224.0.0.85";
 $wgHTCPMulticastAddress = false;
 
+/** Should forwarded Private IPs be accepted? */
+$wgUsePrivateIPs = false;
+
 # Cookie settings:
 #
 /**
index 759857d..771fd57 100644 (file)
@@ -67,7 +67,7 @@ function wfGetAgent() {
  * @return string
  */
 function wfGetIP() {
-       global $wgIP;
+       global $wgIP, $wgUsePrivateIPs;
 
        # Return cached result
        if ( !empty( $wgIP ) ) {
@@ -97,8 +97,10 @@ function wfGetIP() {
        foreach ( $ipchain as $i => $curIP ) {
                $curIP = IP::canonicalize( $curIP );
                if ( wfIsTrustedProxy( $curIP ) ) {
-                       if ( isset( $ipchain[$i + 1] ) && IP::isPublic( $ipchain[$i + 1] ) ) {
-                               $ip = $ipchain[$i + 1];
+                       if ( isset( $ipchain[$i + 1] ) ) {
+                               if( $wgUsePrivateIPs || IP::isPublic( $ipchain[$i + 1 ] ) ) {
+                                       $ip = $ipchain[$i + 1];
+                               }
                        }
                } else {
                        break;