Handle hostnames with upper-case letters
[webmin.git] / nis / edit_security.cgi
1 #!/usr/local/bin/perl
2 # edit_security.cgi
3 # Show NIS server security options
4
5 require './nis-lib.pl';
6 &ui_print_header(undef, $text{'security_title'}, "");
7
8 if (&get_server_mode() == 0 || !(&get_nis_support() & 2)) {
9         print "<p>$text{'security_enis'}<p>\n";
10         &ui_print_footer("", $text{'index_return'});
11         exit;
12         }
13
14 print "<form action=save_security.cgi method=post>\n";
15 print "<table border width=100%>\n";
16 print "<tr $tb> <td><b>$text{'security_header'}</b></td> </tr>\n";
17 print "<tr $cb> <td><table width=100%>\n";
18
19 if ($config{'securenets'}) {
20         print "<tr> <td valign=top><b>$text{'security_nets'}</b></td>\n";
21         print "<td><table border>\n";
22         print "<tr $tb> <td><b>$text{'security_mask'}</b></td> ",
23               "<td><b>$text{'security_net'}</b></td> </tr>\n";
24         open(NETS, $config{'securenets'});
25         while(<NETS>) {
26                 s/#.*$//;
27                 if (/(\S+)\s+(\S+)/) {
28                         push(@nets, [ $1 eq '255.255.255.255' ? 1 :
29                                       $1 eq 'host' ? 1 :
30                                       $1 eq '0.0.0.0' ? 2 : 0, $1, $2 ]);
31                         }
32                 }
33         close(NETS);
34         local $i = 0;
35         foreach $n (@nets, [ -1, "", "" ]) {
36                 print "<tr $cb>\n";
37                 printf "<td><input type=radio name=def_$i value=-1 %s> %s\n",
38                         $n->[0] == -1 ? 'checked' : '', $text{'security_none'};
39                 printf "<input type=radio name=def_$i value=2 %s> %s\n",
40                         $n->[0] == 2 ? 'checked' : '', $text{'security_any'};
41                 printf "<input type=radio name=def_$i value=1 %s> %s\n",
42                         $n->[0] == 1 ? 'checked' : '', $text{'security_single'};
43                 printf "<input type=radio name=def_$i value=0 %s> %s\n",
44                         $n->[0] == 0 ? 'checked' : '', $text{'security_mask'};
45                 printf "<input name=mask_$i size=15 value='%s'></td>\n",
46                         $n->[0] == 0 ? $n->[1] : '';
47                 printf "<td><input name=net_$i size=15 value='%s'></td>\n",
48                         $n->[0] == 2 ? "" : $n->[2];
49                 print "</tr>\n";
50                 $i++;
51                 }
52         print "</table></td></tr>\n";
53         }
54
55 &show_server_security();
56
57 print "</table></td></tr></table>\n";
58 print "<input type=submit value='$text{'security_ok'}'></form>\n";
59
60 &ui_print_footer("", $text{'index_return'});
61