Fix validation of IPv6 addresses
authorJamie Cameron <jcameron@webmin.com>
Fri, 13 Feb 2009 05:58:46 +0000 (05:58 +0000)
committerJamie Cameron <jcameron@webmin.com>
Fri, 13 Feb 2009 05:58:46 +0000 (05:58 +0000)
apache/apache-lib.pl
apache/create_virt.cgi
apache/index.cgi

index de8315c..289ce80 100644 (file)
@@ -1861,5 +1861,11 @@ else {
        }
 }
 
+sub check_apache_ip6address
+{
+local ($ip) = @_;
+return $ip =~ /^\[(\S+)\]$/ && &check_ip6address("$1");
+}
+
 1;
 
index cf7521d..392503b 100755 (executable)
@@ -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'};
index 8981e5d..3369a73 100755 (executable)
@@ -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);
 }