mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
Added logging
This commit is contained in:
@@ -40,5 +40,6 @@ if (!$rv || $rv->code) {
|
||||
&ldap_error($rv)));
|
||||
}
|
||||
|
||||
&webmin_log('create', 'dn', $dn);
|
||||
&redirect("edit_browser.cgi?base=".&urlize($dn));
|
||||
|
||||
|
||||
@@ -24,9 +24,11 @@ $rv = $ldap->modify($bo->dn(),
|
||||
add => { $in{'add'} => $in{'value'} });
|
||||
if (!$rv || $rv->code) {
|
||||
&error(&text('add_emodify', "<tt>".$bo->dn()."</tt>",
|
||||
"<tt>$in{'edit'}</tt>",
|
||||
"<tt>$in{'add'}</tt>",
|
||||
$rv ? $rv->code : "Unknown error"));
|
||||
}
|
||||
|
||||
# Return to object
|
||||
&webmin_log('create', 'attr', $in{'add'}, { 'dn' => $in{'base'},
|
||||
'value' => $in{'value'} });
|
||||
&redirect("edit_browser.cgi?base=".&urlize($in{'base'})."&mode=attrs");
|
||||
|
||||
@@ -28,4 +28,10 @@ if (!$rv || $rv->code) {
|
||||
}
|
||||
|
||||
# Return to object
|
||||
if (@d == 1) {
|
||||
&webmin_log('delete', 'attr', $d[0], { 'dn' => $in{'base'} });
|
||||
}
|
||||
else {
|
||||
&webmin_log('delete', 'attrs', scalar(@d), { 'dn' => $in{'base'} });
|
||||
}
|
||||
&redirect("edit_browser.cgi?base=".&urlize($in{'base'})."&mode=attrs");
|
||||
|
||||
@@ -144,3 +144,19 @@ stop_ekill=Kill process failed : $1
|
||||
start_err=Failed to start LDAP server
|
||||
start_ecmd=$1 failed : $2
|
||||
|
||||
log_create_dn=Created object $1
|
||||
log_delete_dn=Deleted object $1
|
||||
log_rename_dn=Renamed object $1
|
||||
log_delete_dns=Deleted $1 objects
|
||||
log_create_attr=Added attribute to object $2
|
||||
log_create_attr_l=Added attribute $1 with value $3 to object $2
|
||||
log_modify_attr=Updated attribute in object $2
|
||||
log_modify_attr_l=Updated attribute $1 with value $3 in object $2
|
||||
log_delete_attr=Deleted from object $2
|
||||
log_delete_attr_l=Deleted attribute $1 from object $2
|
||||
log_delete_attrs=Deleted $1 attributes from object $2
|
||||
log_stop=Stopped LDAP server
|
||||
log_start=Started LDAP Server
|
||||
log_apply=Applied configuration
|
||||
log_slapd=Changed LDAP server configuration
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Functions for configuring and talking to an LDAP server
|
||||
# XXX help pages
|
||||
# XXX initial setup
|
||||
# XXX locking and logging
|
||||
# XXX install ldap server
|
||||
# XXX default configs for various systems (include search max of 100)
|
||||
# XXX more slapd.conf options
|
||||
|
||||
39
ldap-server/log_parser.pl
Normal file
39
ldap-server/log_parser.pl
Normal file
@@ -0,0 +1,39 @@
|
||||
# log_parser.pl
|
||||
# Functions for parsing this module's logs
|
||||
|
||||
do 'ldap-server-lib.pl';
|
||||
|
||||
# parse_webmin_log(user, script, action, type, object, ¶ms)
|
||||
# Converts logged information from this module into human-readable form
|
||||
sub parse_webmin_log
|
||||
{
|
||||
local ($user, $script, $action, $type, $object, $p, $long) = @_;
|
||||
if ($type eq 'dn') {
|
||||
# Changed some DN
|
||||
$object =~ s/,\s+/,/g;
|
||||
return &text('log_'.$action.'_dn',
|
||||
"<tt>".&html_escape($object)."</tt>");
|
||||
}
|
||||
elsif ($type eq 'dns') {
|
||||
# Multi-DN operation
|
||||
return &text('log_'.$action.'_dns', $object);
|
||||
}
|
||||
elsif ($type eq 'attr') {
|
||||
# Changed some attribute of a DN
|
||||
$p->{'dn'} =~ s/,\s+/,/g;
|
||||
return &text($long ? 'log_'.$action.'_attr_l' : 'log_'.$action.'_attr',
|
||||
"<tt>".&html_escape($object)."</tt>",
|
||||
"<tt>".&html_escape($p->{'dn'})."</tt>",
|
||||
"<tt>".&html_escape($p->{'value'})."</tt>");
|
||||
}
|
||||
elsif ($type eq 'attrs') {
|
||||
# Multi-attribute operation
|
||||
$p->{'dn'} =~ s/,\s+/,/g;
|
||||
return &text('log_'.$action.'_attrs', $object,
|
||||
"<tt>".&html_escape($p->{'dn'})."</tt>");
|
||||
}
|
||||
else {
|
||||
return $text{'log_'.$action};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,5 +32,6 @@ if (!$rv || $rv->code) {
|
||||
}
|
||||
|
||||
# Return to object
|
||||
&webmin_log('rename', 'dn', $in{'old'}, { 'new' => $in{'rename'} });
|
||||
&redirect("edit_browser.cgi?base=".&urlize($in{'base'})."&mode=subs");
|
||||
|
||||
|
||||
@@ -30,4 +30,6 @@ if (!$rv || $rv->code) {
|
||||
}
|
||||
|
||||
# Return to object
|
||||
&webmin_log('modify', 'attr', $in{'edit'}, { 'dn' => $in{'base'},
|
||||
'value' => join(" ", @values) });
|
||||
&redirect("edit_browser.cgi?base=".&urlize($in{'base'})."&mode=attrs");
|
||||
|
||||
@@ -27,4 +27,11 @@ foreach $d (@d) {
|
||||
}
|
||||
|
||||
# Return to object
|
||||
if (@d == 1) {
|
||||
&webmin_log('delete', 'dn', $d[0]);
|
||||
}
|
||||
else {
|
||||
&webmin_log('delete', 'dns', scalar(@d),
|
||||
{ 'dn' => \@d });
|
||||
}
|
||||
&redirect("edit_browser.cgi?base=".&urlize($in{'base'})."&mode=subs");
|
||||
|
||||
Reference in New Issue
Block a user