Handle hostnames with upper-case letters
[webmin.git] / bind8 / conf_net.cgi
1 #!/usr/local/bin/perl
2 # Display global networking options
3
4 require './bind8-lib.pl';
5 $access{'defaults'} || &error($text{'net_ecannot'});
6 &ui_print_header(undef, $text{'net_title'}, "",
7                  undef, undef, undef, undef, &restart_links());
8
9 &ReadParse();
10 $conf = &get_config();
11 $options = &find("options", $conf);
12 $mems = $options->{'members'};
13
14 # Start of form
15 print &ui_form_start("save_net.cgi", "post");
16 print &ui_table_start($text{'net_header'}, "width=100%", 4);
17
18 # Ports and addresses to listen on
19 @listen = &find("listen-on", $mems);
20 $ltable = &ui_radio("listen_def", @listen ? 0 : 1,
21                     [ [ 1, $text{'default'} ],
22                       [ 0, $text{'net_below'} ] ])."<br>\n";
23
24 @table = ( );
25 push(@listen, { });
26 for($i=0; $i<@listen; $i++) {
27         $port = $listen[$i]->{'value'} eq 'port' ?
28                         $listen[$i]->{'values'}->[1] : undef;
29         @vals = map { $_->{'name'} } @{$listen[$i]->{'members'}};
30         push(@table, [
31                 &ui_radio("pdef_$i", $port ? 0 : 1,
32                   [ [ 1, $text{'default'} ],
33                     [ 0, &ui_textbox("port_$i", $port, 5) ] ]),
34                 &ui_textbox("addrs_$i", join(" ", @vals), 50),
35                 ]);
36         }
37 $ltable .= &ui_columns_table(
38         [ $text{'net_port'}, $text{'net_addrs'} ],
39         undef,
40         \@table,
41         undef,
42         1);
43
44 print &ui_table_row($text{'net_listen'}, $ltable, 3);
45 print &ui_table_hr();
46
47 # Source address for queries
48 $src = &find("query-source", $mems);
49 $srcstr = join(" ", @{$src->{'values'}});
50 $sport = $1 if ($srcstr =~ /port\s+(\d+)/i);
51 $saddr = $1 if ($srcstr =~ /address\s+([0-9\.]+)/i);
52 print &ui_table_row($text{'net_saddr'},
53         &ui_opt_textbox("saddr", $saddr, 15, $text{'default'},
54                         $text{'net_ip'}));
55
56 # Source port
57 print &ui_table_row($text{'net_sport'},
58         &ui_opt_textbox("sport", $sport, 5, $text{'default'},
59                         $text{'net_port'}));
60
61 print &addr_match_input($text{'net_topol'}, 'topology', $mems, 1);
62 print &addr_match_input($text{'net_recur'}, 'allow-recursion', $mems, 1);
63
64 print &ui_table_end();
65 print &ui_form_end([ [ undef, $text{'save'} ] ]);
66
67 &ui_print_footer("", $text{'index_return'});
68
69