Code

update: si-server and si-client add ldap attributes gosaLastSystemLogin and gosaLastS...
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 Sep 2008 13:01:48 +0000 (13:01 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 Sep 2008 13:01:48 +0000 (13:01 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12558 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-client
gosa-si/modules/GosaSupportDaemon.pm
gosa-si/server/events/clMessages.pm

index 79a06d412386c6a77507fd2d98bf0a93b68a2317..a3987e70ea920ee83c64028be8bc654ee7441741 100755 (executable)
@@ -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");
index 2e939db40534fe3aea9c0519860fec646cd340db..65bea486ad1499fab5cd1e2d101c9875cfef8028 100644 (file)
@@ -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
index 8dcde99fb202a0a746a3edc35b7bc4057e3de066..5610248fc27ebb58d5d46bb106d385f3cb4e94e6 100644 (file)
@@ -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);
                        }
                }