Handle hostnames with upper-case letters
[webmin.git] / webmin / edit_bind.cgi
1 #!/usr/local/bin/perl
2 # edit_bind.cgi
3 # Display port / address form
4
5 require './webmin-lib.pl';
6 &ui_print_header(undef, $text{'bind_title'}, "");
7 &get_miniserv_config(\%miniserv);
8
9 print $text{'bind_desc'},"<p>\n";
10
11 print &ui_form_start("change_bind.cgi", "post");
12 print &ui_table_start($text{'bind_header'}, undef, 2, [ "width=30%" ]);
13
14 # Build list of sockets
15 @sockets = &get_miniserv_sockets(\%miniserv);
16
17 # Show table of all bound IPs and ports
18 $stable = &ui_columns_start([ $text{'bind_sip'}, $text{'bind_sport'} ]);
19 my $i = 0;
20 my @ports;
21 foreach my $s (@sockets, [ undef, "*" ]) {
22         # IP address
23         my @cols;
24         push(@cols, &ui_select("ip_def_$i", $s->[0] eq "" ? 0 :
25                                             $s->[0] eq "*" ? 1 : 2,
26                                [ [ 0, "&nbsp;" ],
27                                  [ 1, $text{'bind_sip1'} ],
28                                  [ 2, $text{'bind_sip2'} ] ])." ".
29                     &ui_textbox("ip_$i", $s->[0] eq "*" ? undef : $s->[0], 20));
30
31         # Port
32         push(@cols, &ui_select("port_def_$i", $s->[1] eq "*" ? 0 : 1,
33                                [ $i ? ( [ 0, $text{'bind_sport0'} ] ) : ( ),
34                                  [ 1, $text{'bind_sport1'} ] ])." ".
35                     &ui_textbox("port_$i", $s->[1] eq "*" ? undef : $s->[1],5));
36         $stable .= &ui_columns_row(\@cols, [ "nowrap", "nowrap" ]);
37         push(@ports, $s->[1]) if ($s->[1] && $s->[1] ne "*");
38         $i++;
39         }
40 $stable .= &ui_columns_end();
41 if (&foreign_check("firewall")) {
42         print &ui_hidden("oldports", join(" ", @ports));
43         $stable .= &ui_checkbox("firewall", 1, $text{'bind_firewall'}, 1);
44         }
45 print &ui_table_row($text{'bind_sockets'}, $stable);
46
47 # IPv6 enabled?
48 print &ui_table_row($text{'bind_ipv6'},
49         &ui_yesno_radio("ipv6", $miniserv{'ipv6'}));
50
51 # Show UDP listen address
52 print &ui_table_row($text{'bind_listen'},
53     &ui_radio("listen_def", $miniserv{"listen"} ? 0 : 1,
54         [ [ 1, $text{'bind_none'} ],
55           [ 0, &ui_textbox("listen", $miniserv{"listen"}, 6) ] ]));
56
57 # Show web server hostname
58 print &ui_table_row($text{'bind_hostname'},
59     &ui_radio("hostname_def", $miniserv{"host"} ? 0 : 1,
60         [ [ 1, $text{'bind_auto'} ],
61           [ 0, &ui_textbox("hostname", $miniserv{"host"}, 25) ] ]));
62
63 # Reverse-lookup hostname
64 print &ui_table_row($text{'bind_resolv_myname'},
65     &ui_radio("no_resolv_myname", int($miniserv{'no_resolv_myname'}),
66         [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]));
67
68 print &ui_table_end();
69 print &ui_form_end([ [ "save", $text{'save'} ] ]);
70
71 &ui_print_footer("", $text{'index_return'});
72