Handle hostnames with upper-case letters
[webmin.git] / itsecur-firewall / list_services.cgi
1 #!/usr/bin/perl
2 # list_services.cgi
3 # Displays a list of standard and custom services
4
5 require './itsecur-lib.pl';
6 &can_use_error("services");
7 &header($text{'services_title'}, "",
8         undef, undef, undef, undef, &apply_button());
9 print "<hr>\n";
10
11 @services = &list_services();
12 $edit = &can_edit("services");
13 print "<a href='edit_service.cgi?new=1'>$text{'services_add'}</a><br>\n"
14         if ($edit);
15 print "<table border>\n";
16 print "<tr $tb> <td><b>$text{'service_name'}</b></td> ",
17       "<td><b>$text{'service_ports'}</b></td> </tr>\n";
18 if (!$services[0]->{'standard'}) {
19         print "<tr $tb> <td colspan=3><b>$text{'services_header1'}</b></td> </tr>\n";
20         }
21 foreach $s (@services) {
22         if ($s->{'standard'} && !$doneheader) {
23                 print "<tr $tb> <td colspan=3><b>$text{'services_header2'}</b></td> </tr>\n";
24                 $doneheader++;
25                 }
26         print "<tr $cb>\n";
27         if ($s->{'standard'}) {
28                 print "<td>$s->{'name'}</td>\n";
29                 }
30         else {
31                 print "<td><a href='edit_service.cgi?idx=$s->{'index'}'>",
32                       "$s->{'name'}</a></td>\n";
33                 }
34         print "<td>";
35         for($i=0; $i<@{$s->{'protos'}}; $i++) {
36                 print &protocol_name($s->{'protos'}->[$i], $s->{'ports'}->[$i]);
37                 print "\n";
38                 }
39         for($i=0; $i<@{$s->{'others'}}; $i++) {
40                 print "<b>$s->{'others'}->[$i]</b>\n";
41                 }
42         print "</td>\n";
43         print "</tr>\n";
44         }
45 print "</table>\n";
46 print "<a href='edit_service.cgi?new=1'>$text{'services_add'}</a><p>\n"
47         if ($edit);
48
49 print "<hr>\n";
50 &footer("", $text{'index_return'});