Options to enable IPv6 support in Usermin
authorJamie Cameron <jcameron@webmin.com>
Mon, 1 Nov 2010 04:22:23 +0000 (21:22 -0700)
committerJamie Cameron <jcameron@webmin.com>
Mon, 1 Nov 2010 04:22:23 +0000 (21:22 -0700)
usermin/CHANGELOG
usermin/change_bind.cgi
usermin/change_ui.cgi
usermin/edit_bind.cgi

index e020f86..3515b4d 100644 (file)
@@ -45,3 +45,5 @@ Added a field for allowed SSL cipher types.
 Expired passwords can now be changed using an external command, instead of PAM or directly updating /etc/shadow. This is set on the Authentication page.
 ---- Changes since 1.470 ----
 Added a field to the Operating System and Environment page for additional Perl module directories.
+---- Changes since 1.520 ----
+IPv6 support for Usermin can now be enabled on the Ports and Addresses page.
index 7e2f6b7..7c78b40 100755 (executable)
@@ -18,7 +18,9 @@ for($i=0; defined($in{"ip_def_$i"}); $i++) {
                }
        else {
                $ip = $in{"ip_$i"};
-               &check_ipaddress($ip) || &error(&text('bind_eip2', $ip));
+               &check_ipaddress($ip) ||
+                   $in{'ipv6'} && &check_ip6address($ip) ||
+                       &error(&text('bind_eip2', $ip));
                }
        if ($in{"port_def_$i"} == 1) {
                $port = $in{"port_$i"};
@@ -33,6 +35,10 @@ for($i=0; defined($in{"ip_def_$i"}); $i++) {
 @sockets || &error($text{'bind_enone'});
 $in{'hostname_def'} || $in{'hostname'} =~ /^[a-z0-9\.\-]+$/i ||
        &error($text{'bind_ehostname'});
+if ($in{'ipv6'}) {
+       eval "use Socket6";
+       @$ && &error(&webmin::text('bind_eipv6', "<tt>Socket6</tt>"));
+       }
 
 # Update config file
 &lock_file($usermin_miniserv_config);
@@ -45,6 +51,7 @@ else {
        $miniserv{'bind'} = $first->[0];
        }
 $miniserv{'sockets'} = join(" ", map { "$_->[0]:$_->[1]" } @sockets);
+$miniserv{'ipv6'} = $in{'ipv6'};
 if ($in{'listen_def'}) {
        delete($miniserv{'listen'});
        }
index 2eff19c..5e55740 100755 (executable)
@@ -7,8 +7,8 @@ $access{'ui'} || &error($text{'acl_ecannot'});
 &error_setup($text{'ui_err'});
 &ReadParse();
 $in{'feedback_def'} || $in{'feedback'} =~ /\S/ || &error($text{'ui_efeedback'});
-$in{'feedbackmail_def'} || gethostbyname($in{'feedbackmail'}) ||
-    &check_ipaddress($in{'feedbackmail'}) || &error($text{'ui_efeedbackmail'});
+$in{'feedbackmail_def'} || &to_ipaddress($in{'feedbackmail'}) ||
+    &to_ip6address($in{'feedbackmail'}) || &error($text{'ui_efeedbackmail'});
 $in{'feedbackhost_def'} || $in{'feedbackhost'} =~ /^\S+$/ ||
        &error($text{'ui_efeedbackhost'});
 
index 8ea978e..8db94f2 100755 (executable)
@@ -19,17 +19,16 @@ my @sockets = &webmin::get_miniserv_sockets(\%miniserv);
 my $stable = &ui_columns_start([ $text{'bind_sip'}, $text{'bind_sport'} ]);
 my $i = 0;
 foreach $s (@sockets, [ undef, "*" ]) {
-       use Data::Dumper;
-       print "<!-- " . Dumper($s) . " -->\n";
        # IP address
        my @cols;
        push(@cols, &ui_select("ip_def_$i",
                               $s->[0] eq "" ? 0 :
-                             $s->[0] eq "*" ? 1 : 2,
+                              $s->[0] eq "*" ? 1 : 2,
                               [ [ 0, "&nbsp;" ],
                               [ 1, $text{'bind_sip1'} ],
                               [ 2, $text{'bind_sip2'} ] ])." ".
-                              &ui_textbox("ip_$i", $s->[0] eq "*" ? undef : $s->[0], 20));
+                              &ui_textbox("ip_$i",
+                                 $s->[0] eq "*" ? undef : $s->[0], 20));
 
        # Port
        push(@cols, &ui_select("port_def_$i", $s->[1] eq "*" ? 0 : 1,
@@ -42,6 +41,10 @@ foreach $s (@sockets, [ undef, "*" ]) {
 $stable .= &ui_columns_end();
 print &ui_table_row($text{'bind_sockets'}, $stable);
 
+# IPv6 enabled?
+print &ui_table_row($webmin::text{'bind_ipv6'},
+       &ui_yesno_radio("ipv6", $miniserv{'ipv6'}));
+
 # Show web server hostname
 print &ui_table_row($text{'bind_hostname'},
       &ui_radio("hostname_def", $miniserv{"host"} ? 0 : 1,