1# log_parser.pl 2# Functions for parsing this module's logs 3 4do 'ldap-server-lib.pl'; 5 6# parse_webmin_log(user, script, action, type, object, ¶ms) 7# Converts logged information from this module into human-readable form 8sub parse_webmin_log 9{ 10local ($user, $script, $action, $type, $object, $p, $long) = @_; 11if ($type eq 'dn') { 12 # Changed some DN 13 $object =~ s/,\s+/,/g; 14 return &text('log_'.$action.'_dn', 15 "<tt>".&html_escape($object)."</tt>"); 16 } 17elsif ($type eq 'dns') { 18 # Multi-DN operation 19 return &text('log_'.$action.'_dns', $object); 20 } 21elsif ($type eq 'attr') { 22 # Changed some attribute of a DN 23 $p->{'dn'} =~ s/,\s+/,/g; 24 return &text($long ? 'log_'.$action.'_attr_l' : 'log_'.$action.'_attr', 25 "<tt>".&html_escape($object)."</tt>", 26 "<tt>".&html_escape($p->{'dn'})."</tt>", 27 "<tt>".&html_escape($p->{'value'})."</tt>"); 28 } 29elsif ($type eq 'attrs') { 30 # Multi-attribute operation 31 $p->{'dn'} =~ s/,\s+/,/g; 32 return &text('log_'.$action.'_attrs', $object, 33 "<tt>".&html_escape($p->{'dn'})."</tt>"); 34 } 35elsif ($type eq 'access') { 36 return &text('log_'.$action.'_access', 37 $object eq '*' ? $text{'log_all'} : 38 $object =~ /^dn(\.[^=]+)?=(.*)/ ? 39 "<tt>".&html_escape("$2")."</tt>" : 40 "<tt>".&html_escape($object)."</tt>"); 41 } 42elsif ($type eq 'accesses') { 43 return &text('log_'.$action.'_accesses', $object); 44 } 45elsif ($action eq 'sfile' || $action eq 'sup' || $action eq 'sdown') { 46 return &text('log_'.$action, "<tt>".&html_escape($object)."</tt>"); 47 } 48elsif ($action eq 'boot') { 49 return $object ? $text{'log_bootup'} : $text{'log_bootdown'}; 50 } 51elsif ($action eq 'create') { 52 return &text('log_create', "<tt>".&html_escape($object)."</tt>"); 53 } 54else { 55 return $text{'log_'.$action}; 56 } 57} 58 59