summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3b872ed)
raw | patch | inline | side by side (parent: 3b872ed)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 1 Oct 2008 14:20:30 +0000 (14:20 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 1 Oct 2008 14:20:30 +0000 (14:20 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12584 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/server/events/clMessages.pm | patch | blob | history |
index f1db9c6a545fef7f52853286ff9fc7364ce06c7b..4442f377b88327727034244ae28b3f4b1dcc10a4 100644 (file)
# Set gotoLastSystem and gotoLastSystemLogin
} else {
my $ldap_entry= $ldap_mesg->pop_entry();
- if (defined($ldap_entry->get_value('gotoLastSystem'))) {
- $ldap_entry->replace ( 'gotoLastSystem' => $system_dn );
- &main::daemon_log("$session_id INFO: update attribute 'gotoLastSystem'='$system_dn' at ldap entry 'uid=$user'!");
- } else {
- $ldap_entry->add( 'gotoLastSystem' => $system_dn );
- &main::daemon_log("$session_id INFO: add attribute 'gotoLastSystem'='$system_dn' at ldap entry 'uid=$user'!");
- }
- if (defined($ldap_entry->get_value('gotoLastSystemLogin'))) {
- $ldap_entry->replace ( 'gotoLastSystemLogin' => $timestamp );
- &main::daemon_log("$session_id INFO: update attribute 'gotoLastSystemLogin'='$timestamp' at ldap entry 'uid=$user'!");
- } else {
- $ldap_entry->add( 'gotoLastSystemLogin' => $timestamp );
- &main::daemon_log("$session_id INFO: add attribute 'gotoLastSystemLogin'='$timestamp' at ldap entry 'uid=$user'!");
- }
- my $result = $ldap_entry->update($ldap_handle);
- if ($result->code() != 0) {
- &main::daemon_log("$session_id ERROR: setting 'gotoLastSystem' and 'gotoLastSystemLogin' at user '$user' failed: ".
- $result->{'errorMessage'}."\n".
+ my $do_update = 0;
+
+ # Set gotoLastSystem information
+ my $last_system_dn = $ldap_entry->get_value('gotoLastSystem');
+ if ((defined $last_system_dn) && ($last_system_dn eq $system_dn)) {
+ &main::daemon_log("$session_id INFO: no new 'gotoLastSystem' inforamtion for ladp entry 'uid=$user', do nothing!", 5);
+ } elsif ((defined $last_system_dn) && ($last_system_dn ne $system_dn)) {
+ $ldap_entry->replace ( 'gotoLastSystem' => $system_dn );
+ &main::daemon_log("$session_id INFO: update attribute 'gotoLastSystem'='$system_dn' at ldap entry 'uid=$user'!",5);
+ $do_update++;
+ } else {
+ $ldap_entry->add( 'gotoLastSystem' => $system_dn );
+ &main::daemon_log("$session_id INFO: add attribute 'gotoLastSystem'='$system_dn' at ldap entry 'uid=$user'!", 5);
+ $do_update++;
+ }
+
+ # Set gotoLastSystemLogin information
+ # Attention: only write information if last_system_dn and system_dn differs
+ my $last_system_login = $ldap_entry->get_value('gotoLastSystemLogin');
+ if ((defined $last_system_login) && ($last_system_dn eq $system_dn)) {
+ &main::daemon_log("$session_id INFO: no new 'gotoLastSystemLogin' inforamtion for ladp entry 'uid=$user', do nothing!", 5);
+ } elsif ((defined $last_system_login) && ($last_system_dn ne $system_dn)) {
+ $ldap_entry->replace ( 'gotoLastSystemLogin' => $timestamp );
+ &main::daemon_log("$session_id INFO: update attribute 'gotoLastSystemLogin'='$timestamp' at ldap entry 'uid=$user'!", 5);
+ $do_update++;
+ } else {
+ $ldap_entry->add( 'gotoLastSystemLogin' => $timestamp );
+ &main::daemon_log("$session_id INFO: add attribute 'gotoLastSystemLogin'='$timestamp' at ldap entry 'uid=$user'!",5);
+ $do_update++;
+ }
+
+ if ($do_update) {
+ my $result = $ldap_entry->update($ldap_handle);
+ if ($result->code() != 0) {
+ &main::daemon_log("$session_id ERROR: setting 'gotoLastSystem' and 'gotoLastSystemLogin' at user '$user' failed: ".
+ $result->{'errorMessage'}."\n".
"\tbase: $main::ldap_base\n".
"\tscope: 'sub'\n".
"\tfilter: 'uid=$user'\n".
"\tmessage: $msg", 1);
- }
+ }
+ }
}
}