(bug 3340) Allow configuring of /16 limit on range blocks
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 30 Oct 2009 21:41:34 +0000 (21:41 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 30 Oct 2009 21:41:34 +0000 (21:41 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/specials/SpecialBlockip.php

index 45e1e41..ee5650b 100644 (file)
@@ -90,6 +90,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * $wgCapitalLinkOverrides added to configure per-namespace capitalization
 * (bug 21172) $wgSorbsUrl can now be an array with multiple DNSBL
 * $wgEnableHtmlDiff has been removed
+* (bug 3340) $wgBlockCIDRLimit added (default: 16) to configure the low end of
+  CIDR ranges for blocking
 
 === New features in 1.16 ===
 
index 4e49053..6f03c8b 100644 (file)
@@ -1271,6 +1271,7 @@ $wgSysopRangeBans       = true; # Allow sysops to ban IP ranges
 $wgAutoblockExpiry      = 86400; # Number of seconds before autoblock entries expire
 $wgBlockAllowsUTEdit    = false; # Default setting for option on block form to allow self talkpage editing whilst blocked
 $wgSysopEmailBans       = true; # Allow sysops to ban users from accessing Emailuser
+$wgBlockCIDRLimit       = 16; # Blocks below the /16 set of IPs will not be allowed
 
 # Pages anonymous user may see as an array, e.g.:
 # array ( "Main Page", "Wikipedia:Help");
index a32092e..81bdb64 100644 (file)
@@ -345,7 +345,7 @@ class IPBlockForm {
         * @return array(message key, arguments) on failure, empty array on success
         */
        function doBlock( &$userId = null, &$expiry = null ) {
-               global $wgUser, $wgSysopUserBans, $wgSysopRangeBans, $wgBlockAllowsUTEdit;
+               global $wgUser, $wgSysopUserBans, $wgSysopRangeBans, $wgBlockAllowsUTEdit, $wgBlockCIDRLimit;
 
                $userId = 0;
                # Expand valid IPv6 addresses, usernames are left as is
@@ -361,7 +361,7 @@ class IPBlockForm {
                        if( preg_match( "/^($rxIP4)\\/(\\d{1,2})$/", $this->BlockAddress, $matches ) ) {
                                # IPv4
                                if( $wgSysopRangeBans ) {
-                                       if( !IP::isIPv4( $this->BlockAddress ) || $matches[2] < 16 || $matches[2] > 32 ) {
+                                       if( !IP::isIPv4( $this->BlockAddress ) || $matches[2] < $wgBlockCIDRLimit || $matches[2] > 32 ) {
                                                return array( 'ip_range_invalid' );
                                        }
                                        $this->BlockAddress = Block::normaliseRange( $this->BlockAddress );