From: rettenbe Date: Mon, 29 Sep 2008 13:01:48 +0000 (+0000) Subject: update: si-server and si-client add ldap attributes gosaLastSystemLogin and gosaLastS... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ffc42c7d8064be87c804bb11e89497ddbfbb39a9;p=gosa.git update: si-server and si-client add ldap attributes gosaLastSystemLogin and gosaLastSystem git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12558 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client index 79a06d412..a3987e70e 100755 --- a/gosa-si/gosa-si-client +++ b/gosa-si/gosa-si-client @@ -551,15 +551,15 @@ sub register_at_gosa_si_server { # Check if our ip is resolvable - if not: don't try to register my $ip= &get_local_ip_for_remote_ip(sprintf("%s", $server =~ /^([0-9\.]*?):.*$/)); my $dnsname= gethostbyaddr(inet_aton($ip), AF_INET); - if(!defined($dnsname)) { - if( defined($client_force_hostname) && $client_force_hostname eq "true") { - $dnsname = `hostname`; - } else { - &write_to_file("goto-error-dns:$ip", $fai_logpath); + if(!defined($dnsname)) { + if( defined($client_force_hostname) && $client_force_hostname eq "true") { + $dnsname = `hostname`; + } else { + &write_to_file("goto-error-dns:$ip", $fai_logpath); &main::daemon_log("ERROR: ip is not resolvable, no registration possible. Write 'goto-error-dns:$ip' to $fai_logpath", 1); - exit(1); - } - } + exit(1); + } + } # create registration msg my $local_ip = &get_local_ip_for_remote_ip(sprintf("%s", $server =~ /^([0-9\.]*?):.*$/)); @@ -806,7 +806,7 @@ sub fifo_got_record { my $clmsg_hash = &create_xml_hash("CLMSG_$header", $client_address, $server_address, $content); &add_content2xml_hash($clmsg_hash, "macaddress", $client_mac_address); - my $utc_ts = &get_utc_time(); + my $utc_ts = &main::get_utc_time(); &add_content2xml_hash($clmsg_hash, "timestamp", $utc_ts); my $clmsg = &create_xml_string($clmsg_hash); &send_msg_to_target($clmsg, $server_address, $server_key, "CLMSG_$header"); diff --git a/gosa-si/modules/GosaSupportDaemon.pm b/gosa-si/modules/GosaSupportDaemon.pm index 2e939db40..65bea486a 100644 --- a/gosa-si/modules/GosaSupportDaemon.pm +++ b/gosa-si/modules/GosaSupportDaemon.pm @@ -10,6 +10,7 @@ my @functions = ( "create_xml_string", "transform_msg2hash", "get_time", + "get_utc_time", "build_msg", "db_res2xml", "db_res2si_msg", @@ -193,6 +194,13 @@ sub get_time { } +sub get_utc_time { + my $utc_time = qx(date --utc +%Y%m%d%H%M%S); + $utc_time =~ s/\s$//; + return $utc_time; +} + + #=== FUNCTION ================================================================ # NAME: build_msg # DESCRIPTION: Send a message to a destination diff --git a/gosa-si/server/events/clMessages.pm b/gosa-si/server/events/clMessages.pm index 8dcde99fb..5610248fc 100644 --- a/gosa-si/server/events/clMessages.pm +++ b/gosa-si/server/events/clMessages.pm @@ -316,16 +316,21 @@ sub set_last_system { $ldap_entry->replace ( 'gosaLastSystem' => $system_dn ); } else { $ldap_entry->add( 'gosaLastSystem' => $system_dn ); + &main::daemon_log("$session_id INFO: ldap entry 'uid=$user' do not know attribute 'gosaLastSystem', add attribute!"); } if (defined($ldap_entry->get_value('gosaLastSystemLogin'))) { $ldap_entry->replace ( 'gosaLastSystemLogin' => $timestamp ); } else { $ldap_entry->add( 'gosaLastSystemLogin' => $timestamp ); + &main::daemon_log("$session_id INFO: ldap entry 'uid=$user' do not know attribute 'gosaLastSystemLogin', add attribute!"); } my $result = $ldap_entry->update($ldap_handle); if ($result->code() != 0) { &main::daemon_log("$session_id ERROR: setting 'gosaLastSystem' and 'gosaLastSystemLogin' at user '$user' failed: ". - $result->{'errorMessage'}, 1); + $result->{'errorMessage'}."\n". + "\tbase: $main::ldap_base\n". + "\tscope: 'sub'\n". + "\tfilter: 'uid=$user'", 1); &main::daemon_log("$session_id ERROR: $msg", 1); } }