SECURITY: Don't cache when a call could autocreate
[lhc/web/wiklou.git] / includes / ProxyTools.php
index 4efd347..a0f9e5f 100644 (file)
@@ -77,18 +77,20 @@ function wfIsTrustedProxy( $ip ) {
  * Checks if an IP matches a proxy we've configured.
  * @param $ip String
  * @return bool
+ * @since 1.23 Supports CIDR ranges in $wgSquidServersNoPurge
  */
 function wfIsConfiguredProxy( $ip ) {
        global $wgSquidServers, $wgSquidServersNoPurge;
 
        // quick check of known proxy servers
-       $trusted = in_array( $ip, $wgSquidServers );
+       $trusted = in_array( $ip, $wgSquidServers )
+               || in_array( $ip, $wgSquidServersNoPurge );
 
        if ( !$trusted ) {
                // slightly slower check to see if the ip is listed directly or in a CIDR
                // block in $wgSquidServersNoPurge
                foreach ( $wgSquidServersNoPurge as $block ) {
-                       if ( IP::isInRange( $ip, $block ) ) {
+                       if ( strpos( $block, '/' ) !== false && IP::isInRange( $ip, $block ) ) {
                                $trusted = true;
                                break;
                        }