IPv6 virtualhost support
authorJamie Cameron <jcameron@webmin.com>
Sun, 7 Nov 2010 19:56:13 +0000 (11:56 -0800)
committerJamie Cameron <jcameron@webmin.com>
Sun, 7 Nov 2010 19:56:13 +0000 (11:56 -0800)
proftpd/create_virt.cgi
proftpd/mod_core.pl
proftpd/save_vserv.cgi

index 96cb395..9007796 100755 (executable)
@@ -8,8 +8,8 @@ $conf = &get_config();
 &error_setup($text{'vserv_err'});
 
 # Validate inputs
-$in{'addr_def'} || gethostbyname($in{'addr'}) ||
-    &check_ipaddress($in{'addr'}) ||
+$in{'addr_def'} || &to_ipaddress($in{'addr'}) ||
+    &to_ip6address($in{'addr'}) ||
        &error($text{'vserv_eaddr'});
 $in{'Port_def'} || $in{'Port'} =~ /^\d+$/ ||
        &error($text{'vserv_eport'});
index 9c9770c..7628d73 100755 (executable)
@@ -172,12 +172,14 @@ for($i=0; defined($type = $in{"allow_type_$i"}); $i++) {
        if ($mode == 0) { $what = "all"; }
        elsif ($mode == 1) { $what = "none"; }
        elsif ($mode == 2) {
-               &check_ipaddress($what) || &error(&text('mod_core_eip', $what));
+               &check_ipaddress($what) || &check_ip6address($what) ||
+                       &error(&text('mod_core_eip', $what));
                }
        elsif ($mode == 3) {
                $what =~ /^[0-9\.]+\.$/ ||
-                       $what =~ /^([0-9\.]+)\/\d+$/ && &check_ipaddress($1) ||
-                               &error(&text('mod_core_enet', $what));
+                   $what =~ /^([0-9\.]+)\/\d+$/ && &check_ipaddress("$1") ||
+                   $what =~ /^([a-f0-9:]+)\/\d+$/ && &check_ip6address("$1") ||
+                       &error(&text('mod_core_enet', $what));
                }
        elsif ($mode == 4) {
                $what =~ /^[A-Za-z0-9\.\-]+$/ ||
index 939bb74..d49f1af 100755 (executable)
@@ -25,7 +25,7 @@ else {
        &error_setup($text{'vserv_err'});
 
        # Check inputs
-       gethostbyname($in{'addr'}) || &to_ipaddress($in{'addr'}) ||
+       &to_ipaddress($in{'addr'}) || &to_ip6address($in{'addr'}) ||
                &error($text{'vserv_eaddr'});
        $in{'Port_def'} || $in{'Port'} =~ /^\d+$/ ||
                &error($text{'vserv_eport'});