Handle hostnames with upper-case letters
[webmin.git] / itsecur-firewall / list_nat.cgi
1 #!/usr/bin/perl
2 # list_nat.cgi
3 # Show NAT enable form
4
5 require './itsecur-lib.pl';
6 &can_use_error("nat");
7 &header($text{'nat_title'}, "",
8         undef, undef, undef, undef, &apply_button());
9 print "<hr>\n";
10
11 print "<form action=save_nat.cgi>\n";
12 print "<table border>\n";
13 print "<tr $tb> <td><b>$text{'nat_header'}</b></td> </tr>\n";
14 print "<tr $cb> <td><table>\n";
15
16 ($iface, @nets) = &get_nat();
17 @maps = grep { ref($_) } @nets;
18 @nets = grep { !ref($_) } @nets;
19 print "<tr> <td valign=top><b>$text{'nat_desc'}</b></td> <td colspan=3>\n";
20 printf "<input type=radio name=nat value=0 %s> %s<br>\n",
21         $iface ? "" : "checked", $text{'nat_disabled'};
22 printf "<input type=radio name=nat value=1 %s> %s\n",
23         $iface ? "checked" : "", $text{'nat_enabled'};
24 print &iface_input("iface", $iface);
25 print "</td> </tr>\n";
26
27 print "<tr> <td valign=top><b>$text{'nat_nets'}</b></td>\n";
28 print "<td valign=top><table>\n";
29 $i = 0;
30 foreach $n ((grep { $_ !~ /^\!/ } @nets), undef, undef, undef) {
31         print "<tr> <td>",&group_input("net_$i", $n, 1),"</td> </tr>\n";
32         $i++;
33         }
34 print "</table></td>\n";
35
36 print "<td valign=top><b>$text{'nat_excl'}</b></td>\n";
37 print "<td valign=top><table>\n";
38 $i = 0;
39 foreach $n ((grep { $_ =~ /^\!/ } @nets), undef, undef, undef) {
40         print "<tr> <td>",&group_input("excl_$i", $n =~ /^\!(.*)/ ? $1 : undef, 1),"</td> </tr>\n";
41         $i++;
42         }
43 print "</table></td> </tr>\n";
44
45 print "<tr> <td valign=top><b>$text{'nat_maps'}</b>",
46       "<br>$text{'nat_mapsdesc'}</td> <td colspan=3>\n";
47 print "<table>\n";
48 print "<tr> <td><b>$text{'nat_ext'}</b></td> ",
49       "<td><b>$text{'nat_int'}</b></td> ",
50       "<td><b>$text{'nat_virt'}</b></td> </tr>\n";
51 $i = 0;
52 foreach $m (@maps, [ ], [ ], [ ]) {
53         #print "<tr>\n";
54         #printf "<td><input name=ext_%d size=20 value='%s'></td>\n",
55         #       $i, $m->[0];
56         #printf "<td><input name=int_%d size=20 value='%s'></td>\n",
57         #       $i, $m->[1];
58         #print "<td>",&iface_input("virt_$i", $m->[2], 1, 1, 1),"</td>\n";
59         #print "</tr>\n";
60         print "<tr>"    ;       
61         printf "<td><input name=ext_%d size=20 value='%s'></td>\n",
62                 $i, $m->[0];
63         print "<td>",&group_input("int_$i", $m->[1], 1),"</td>\n";
64         print "<td>",&iface_input("virt_$i", $m->[2], 1, 1, 1),"</td>\n";               
65         print "</tr>\n";
66         $i++;
67         }
68 print "</table></td> </tr>\n";
69
70 print "</table></td></tr></table>\n";
71 print "<input type=submit value='$text{'save'}'></form>\n";
72 &can_edit_disable("nat");
73
74 print "<hr>\n";
75 &footer("", $text{'index_return'});