Bug #27294
closedIPv6 Support for $TYPO3_CONF_VARS['FE']['IPmaskMountGroups'] broken
0%
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;
}