Jasper Deng has uploaded a new change for review.
https://gerrit.wikimedia.org/r/57034
Change subject: Add a new configuration variable $wgCheckUserCIDRLimit that
determines the sizes of IPv4 and IPv6 ranges that can be checked. The
checkuser-summary message may need to be updated to reflect this change; the
defaults for IPv4 and IPv6 are left at their pre
......................................................................
Add a new configuration variable $wgCheckUserCIDRLimit that determines the
sizes of IPv4 and IPv6 ranges that can be checked. The checkuser-summary
message may need to be updated to reflect this change; the defaults for
IPv4 and IPv6 are left at their previous hard-coded states.
Change-ID: If21cc97cac3ed4a063e3ab9998215df27914487e
---
M CheckUser.php
M specials/SpecialCheckUser.php
2 files changed, 5 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CheckUser
refs/changes/34/57034/1
diff --git a/CheckUser.php b/CheckUser.php
index 409fbe1..b7c94bc 100644
--- a/CheckUser.php
+++ b/CheckUser.php
@@ -106,3 +106,5 @@
$wgAPIListModules['checkuser'] = 'ApiQueryCheckUser';
$wgAutoloadClasses['ApiQueryCheckUserLog'] =
"$dir/api/ApiQueryCheckUserLog.php";
$wgAPIListModules['checkuserlog'] = 'ApiQueryCheckUserLog';
+//Maximum CIDR limits that can be checked
+$wgCheckUserCIDRLimit=array('IPv4'=>16,'IPv6'=>48);
\ No newline at end of file
diff --git a/specials/SpecialCheckUser.php b/specials/SpecialCheckUser.php
index e7b401a..577aacd 100644
--- a/specials/SpecialCheckUser.php
+++ b/specials/SpecialCheckUser.php
@@ -1334,18 +1334,19 @@
* @return mixed array/false conditions
*/
public static function getIpConds( $db, $ip, $xfor = false ) {
+ global $wgCheckUserCIDRLimit;
$type = ( $xfor ) ? 'xff' : 'ip';
// IPv4 CIDR, 16-32 bits
$matches = array();
if ( preg_match( '#^(\d+\.\d+\.\d+\.\d+)/(\d+)$#', $ip,
$matches ) ) {
- if ( $matches[2] < 16 || $matches[2] > 32 ) {
+ if ( $matches[2] < $wgCheckUserCIDRLimit['IPv4'] ||
$matches[2] > 32 ) {
return false; // invalid
}
list( $start, $end ) = IP::parseRange( $ip );
return array( 'cuc_' . $type . '_hex BETWEEN ' .
$db->addQuotes( $start ) . ' AND ' . $db->addQuotes( $end ) );
} elseif ( preg_match(
'#^\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}/(\d+)$#',
$ip, $matches ) ) {
// IPv6 CIDR, 48-128 bits
- if ( $matches[1] < 48 || $matches[1] > 128 ) {
+ if ( $matches[1] < $wgCheckUserCIDRLimit['IPv6'] ||
$matches[1] > 128 ) {
return false; // invalid
}
list( $start, $end ) = IP::parseRange( $ip );
--
To view, visit https://gerrit.wikimedia.org/r/57034
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If21cc97cac3ed4a063e3ab9998215df27914487e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CheckUser
Gerrit-Branch: master
Gerrit-Owner: Jasper Deng <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits