Fix validation of IPv6 addresses

This commit is contained in:
Jamie Cameron
2009-02-13 05:58:46 +00:00
parent 20ffc9fd80
commit 3190c60a27
3 changed files with 8 additions and 2 deletions

View File

@@ -1861,5 +1861,11 @@ else {
}
}
sub check_apache_ip6address
{
local ($ip) = @_;
return $ip =~ /^\[(\S+)\]$/ && &check_ip6address("$1");
}
1;

View File

@@ -32,7 +32,7 @@ else {
@addrs = split(/\s+/, $in{'addr'});
foreach $a (@addrs) {
gethostbyname($a) || &check_ipaddress($a) ||
&check_ip6address($a) ||
&check_apache_ip6address($a) ||
&error(&text('cvirt_eaddr2', $a));
}
$addr = $in{'addr'};

View File

@@ -453,7 +453,7 @@ local $addr = $_[0]->{'words'}->[0] =~ /^(\S+):(\S+)/ ? $1 :
$_[0]->{'words'}->[0];
return $addr eq '_default_' || $addr eq '*' ? undef :
&check_ipaddress($addr) ? $addr :
&check_ip6address($addr) ? $addr :
&check_apache_ip6address($addr) ? $addr :
&to_ipaddress($addr);
}