Handle hostnames with upper-case letters
[webmin.git] / net / acl_security.pl
1
2 require 'net-lib.pl';
3
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the net module
6 sub acl_security_form
7 {
8 print "<tr> <td valign=top><b>$text{'acl_ifcs'}</b></td> <td colspan=3>\n";
9 printf "<input type=radio name=ifcs value=2 %s> $text{'yes'}\n",
10         $_[0]->{'ifcs'} == 2 ? "checked" : "";
11 printf "<input type=radio name=ifcs value=1 %s> $text{'acl_view'}\n",
12         $_[0]->{'ifcs'} == 1 ? "checked" : "";
13 printf "<input type=radio name=ifcs value=0 %s> $text{'no'}<br>\n",
14         $_[0]->{'ifcs'} ? "" : "checked";
15 printf "<input type=radio name=ifcs value=3 %s> $text{'acl_ifcs_only'}\n",
16         $_[0]->{'ifcs'} == 3 ? "checked" : "";
17 print "<input name=interfaces3 size=30 value='".$_[0]->{'interfaces'}."'> ",
18         &interfaces_chooser_button("interfaces", 1),"<br>\n";
19 printf "<input type=radio name=ifcs value=4 %s> $text{'acl_ifcs_ex'}\n",
20         $_[0]->{'ifcs'} == 4 ? "checked" : "";
21 print "<input name=interfaces4 size=30 value='".$_[0]->{'interfaces'}."'> ",
22         &interfaces_chooser_button("interfaces", 1),"</td> </tr>\n";
23
24 print "<tr> <td><b>$text{'acl_bootonly'}</b></td>\n";
25 print "<td>",&ui_radio("bootonly", $_[0]->{'bootonly'},
26                  [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]),"</td>\n";
27
28 print "<td><b>$text{'acl_netmask'}</b></td>\n";
29 print "<td>",&ui_radio("netmask", $_[0]->{'netmask'},
30                  [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td> </tr>\n";
31
32 print "<tr> <td><b>$text{'acl_broadcast'}</b></td>\n";
33 print "<td>",&ui_radio("broadcast", $_[0]->{'broadcast'},
34                  [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td>\n";
35
36 print "<td><b>$text{'acl_mtu'}</b></td>\n";
37 print "<td>",&ui_radio("mtu", $_[0]->{'mtu'},
38                  [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td> </tr>\n";
39
40 print "<tr> <td><b>$text{'acl_up'}</b></td>\n";
41 print "<td>",&ui_radio("up", $_[0]->{'up'},
42                  [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td>\n";
43
44 print "<td><b>$text{'acl_virt'}</b></td>\n";
45 print "<td>",&ui_radio("virt", $_[0]->{'virt'},
46                  [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td> </tr>\n";
47
48 print "<tr> <td><b>$text{'acl_delete'}</b></td>\n";
49 print "<td>",&ui_radio("delete", $_[0]->{'delete'},
50                  [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td>\n";
51
52 print "<td><b>$text{'acl_hide'}</b></td>\n";
53 print "<td>",&ui_radio("hide", $_[0]->{'hide'},
54                  [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td> </tr>\n";
55
56 print "<tr> <td><b>$text{'acl_routes'}</b></td> <td colspan=3>\n";
57 printf "<input type=radio name=routes value=2 %s> $text{'yes'}\n",
58         $_[0]->{'routes'} == 2 ? "checked" : "";
59 printf "<input type=radio name=routes value=1 %s> $text{'acl_view'}\n",
60         $_[0]->{'routes'} == 1 ? "checked" : "";
61 printf "<input type=radio name=routes value=0 %s> $text{'no'}</td> </tr>\n",
62         $_[0]->{'routes'} ? "" : "checked";
63
64 print "<tr> <td><b>$text{'acl_dns'}</b></td> <td colspan=3>\n";
65 printf "<input type=radio name=dns value=2 %s> $text{'yes'}\n",
66         $_[0]->{'dns'} == 2 ? "checked" : "";
67 printf "<input type=radio name=dns value=1 %s> $text{'acl_view'}\n",
68         $_[0]->{'dns'} == 1 ? "checked" : "";
69 printf "<input type=radio name=dns value=0 %s> $text{'no'}</td> </tr>\n",
70         $_[0]->{'dns'} ? "" : "checked";
71
72 print "<tr> <td><b>$text{'acl_hosts'}</b></td> <td colspan=3>\n";
73 printf "<input type=radio name=hosts value=2 %s> $text{'yes'}\n",
74         $_[0]->{'hosts'} == 2 ? "checked" : "";
75 printf "<input type=radio name=hosts value=1 %s> $text{'acl_view'}\n",
76         $_[0]->{'hosts'} == 1 ? "checked" : "";
77 printf "<input type=radio name=hosts value=0 %s> $text{'no'}</td> </tr>\n",
78         $_[0]->{'hosts'} ? "" : "checked";
79
80 print "<tr> <td><b>$text{'acl_apply'}</b></td> <td colspan=3>\n";
81 printf "<input type=radio name=apply value=2 %s> $text{'yes'}\n",
82         $_[0]->{'apply'} == 1 ? "checked" : "";
83 printf "<input type=radio name=apply value=0 %s> $text{'no'}</td> </tr>\n",
84         $_[0]->{'apply'} ? "" : "checked";
85 }
86
87 # acl_security_save(&options)
88 # Parse the form for security options for the file module
89 sub acl_security_save
90 {
91 $_[0]->{'ifcs'} = $in{'ifcs'};
92 $_[0]->{'routes'} = $in{'routes'};
93 $_[0]->{'dns'} = $in{'dns'};
94 $_[0]->{'hosts'} = $in{'hosts'};
95 $_[0]->{'interfaces'} = $in{'ifcs'} == 3 ? $in{'interfaces3'} :
96                         $in{'ifcs'} == 4 ? $in{'interfaces4'} : undef;
97 $_[0]->{'apply'} = $in{'apply'};
98 $_[0]->{'bootonly'} = $in{'bootonly'};
99 $_[0]->{'netmask'} = $in{'netmask'};
100 $_[0]->{'broadcast'} = $in{'broadcast'};
101 $_[0]->{'mtu'} = $in{'mtu'};
102 $_[0]->{'up'} = $in{'up'};
103 $_[0]->{'virt'} = $in{'virt'};
104 $_[0]->{'delete'} = $in{'delete'};
105 $_[0]->{'hide'} = $in{'hide'};
106 }
107