Handle hostnames with upper-case letters
[webmin.git] / itsecur-firewall / log_parser.pl
1 # log_parser.pl
2 # Functions for parsing this module's logs
3
4 do 'itsecur-lib.pl';
5
6 # parse_webmin_log(user, script, action, type, object, &params)
7 # Converts logged information from this module into human-readable form
8 sub parse_webmin_log
9 {
10 local ($user, $script, $action, $type, $object, $p) = @_;
11 if ($type eq "rule") {
12         local $source = &group_names($p->{'source'});
13         local $dest = &group_names($p->{'dest'});
14         return &text('log_'.$action.'_'.$type, $source, $dest);
15         }
16 elsif ($type eq "service" || $type eq "group" || $type eq "user" ||
17        $type eq "time" || $type eq "sep") {
18         return &text('log_'.$action.'_'.$type,
19                      "<tt>".&html_escape($object)."</tt>");
20         }
21 elsif ($type eq "nat" || $type eq "pat" || $type eq "spoof") {
22         return $text{'log_'.$action.'_'.$type};
23         }
24 elsif ($action eq "backup" || $action eq "restore") {
25         return $object ? &text('log_'.$action, "<tt>".&html_escape($object)."</tt>") : $text{'log_'.$action.'_file'};
26         }
27 elsif ($action eq "import") {
28         return $text{'log_import_'.$type};
29         }
30 elsif ($type eq "rules") {
31         if (defined($p->{'enabled'})) {
32                 return &text('log_oldenable_rules',
33                              $p->{'enabled'}, $p->{'disabled'});
34                 }
35         else {
36                 return &text('log_'.$action.'_rules', $p->{'count'});
37                 }
38         }
39 else {
40         return $text{'log_'.$action};
41         }
42 }
43