Commit 7629d5ff by Scott

Fix wildcard error in ipv6_expand

parent 69749a0d
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
$wildcards = explode(":", $ip); $wildcards = explode(":", $ip);
foreach($wildcards as $index => $value){ foreach($wildcards as $index => $value){
if($value == "*"){ if($value == "*"){
$wildcards_matched[]=$index; $wildcards_matched[]=count($wildcards)-1-$index;
$wildcards[$index]="0"; $wildcards[$index]="0";
} }
} }
...@@ -250,8 +250,9 @@ ...@@ -250,8 +250,9 @@
if($ipv6_wildcard){ if($ipv6_wildcard){
$wildcards = explode(":", $ip); $wildcards = explode(":", $ip);
foreach($wildcards_matched as $index => $value){ foreach($wildcards_matched as $value){
$wildcards[$value]="*"; $i = count($wildcards)-1-$value;
$wildcards[$i]="*";
} }
$ip=implode($wildcards,":"); $ip=implode($wildcards,":");
} }
......
...@@ -24,7 +24,7 @@ class AppLimitsTest extends PHPUnit_Framework_TestCase ...@@ -24,7 +24,7 @@ class AppLimitsTest extends PHPUnit_Framework_TestCase
$ipv6_range3 = '::ffff:7f00:0001-0:0:0:0:0:ffff:7f00:0099'; $ipv6_range3 = '::ffff:7f00:0001-0:0:0:0:0:ffff:7f00:0099';
$ipv6_wildcard1 = '::ffff:7f00:*'; $ipv6_wildcard1 = '::ffff:7f00:*';
$ipv6_wildcard2 = '::ffff:7e99:*'; $ipv6_wildcard2 = '::ffff:7e99:*';
$ipv6_wildcard3 = '::*:7f00:*'; $ipv6_wildcard3 = '::ffff:*:*';
// check mixed types // check mixed types
$this->assertSame(false, qa_block_ip_match($ipv4b, $ipv6), 'Mixed IP types'); $this->assertSame(false, qa_block_ip_match($ipv4b, $ipv6), 'Mixed IP types');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment