Bug #27294

IPv6 Support for $TYPO3_CONF_VARS['FE']['IPmaskMountGroups'] broken

Added by Franz Vinzenz over 10 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Miscellaneous
Target version:
-
Start date:
2011-06-08
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

In the File t3lib\class.t3lib_div.php on Line 802 in the function cmpIPv6($baseIP, $list) doesnt work correct.

There are 2 Problems.
1. ) There are only /48 and /64 Masks supported.
2.) It seems the function IPv6Hex2Bin doesnt work correct in conjunction with the substr. I think the third parameter is incorrect, as it means bytes instead of Bits.


My suggestion is instead oft he case to calculate the length oft he strings from the mask.

To support flexible Masks , instead of the function baseIPBin there schuold be used a function wich returns a String representation of the bits in zhe address. (string length = 128). so the substring function can use the value fo the mask.


In my opinion the call of self::IPv6Hex2Bin an be replaced with str_replace.

the followin code sequence could replace the entire
switch ($mask) { // test on /48 /64
block in the File t3lib\class.t3lib_div.php on Line 802 in the function cmpIPv6($baseIP, $list)

//-----------------------------------------------
if ($mask % 4) {
$success = FALSE;
} else {
$testBin = substr(str_replace(':', '', $test), 0, $mask / 4);
$baseIPBin = substr(str_replace(':', '', $baseIP), 0, $mask / 4);
$success = strcmp($testBin, $baseIPBin) == 0 ? TRUE : FALSE;
}


Related issues

Related to TYPO3 Core - Bug #27210: t3lib_div::cmpIPv6() fails to compareClosedStefan Neufeind2011-06-04

Actions

Also available in: Atom PDF