Code

change handling of undecipherable messages
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 8 May 2009 14:00:45 +0000 (14:00 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 8 May 2009 14:00:45 +0000 (14:00 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13637 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server

index ffa57e14cced9b2baa776a7a57160b09b2155140..192e8d65f323cf0af3744221f952ea1ad6e731a2 100755 (executable)
@@ -1072,11 +1072,12 @@ sub msg_to_decrypt {
 
        # msg is from a gosa-si-server
        if(( !$msg ) || ( !$msg_hash ) || ( !$module )){
-               ($msg, $msg_hash, $module) = &input_from_known_server($next_msg, $heap->{'remote_ip'}, $session_id);
+               #($msg, $msg_hash, $module) = &input_from_known_server($next_msg, $heap->{'remote_ip'}, $session_id);
+               ($msg, $msg_hash, $module) = &input_from_known_server($next_msg, $msg_source, $session_id);
        }
        # msg is from a gosa-si-client
        if(( !$msg ) || ( !$msg_hash ) || ( !$module )){
-               ($msg, $msg_hash, $module) = &input_from_known_client($next_msg, $heap->{'remote_ip'}, $session_id);
+               ($msg, $msg_hash, $module) = &input_from_known_client($next_msg, $msg_source, $session_id);
        }
        # an error occurred
        if(( !$msg ) || ( !$msg_hash ) || ( !$module )){
@@ -1084,7 +1085,7 @@ sub msg_to_decrypt {
                # or a server.  In case of a client, send a ping. If the client could not understand a msg from its 
                # server the client cause a re-registering process. In case of a server, decrease update_time in kown_server_db
                # and trigger a re-registering process for servers
-               if (defined $msg_source && $msg_source =~ /^\d+:$server_port$/)
+               if (defined $msg_source && $msg_source =~ /:$server_port$/)
                {
                        daemon_log("$session_id WARNING: Cannot understand incoming msg from server '$msg_source'. Cause re-registration process for servers.", 3);
                        my $update_statement = "UPDATE $known_server_tn SET update_time='19700101000000' WHERE hostname='$msg_source'"; 
@@ -1092,14 +1093,20 @@ sub msg_to_decrypt {
                        my $upadte_res = $known_server_db->exec_statement($update_statement);
                        $kernel->yield("register_at_foreign_servers");
                }
-               else
+               elsif (defined $msg_source)
                {
-                       daemon_log("$session_id WARNING: Cannot understand incoming msg from client '".$heap->{remote_ip}."'. Send ping-msg to cause a re-registering of the client if necessary", 3);
-                       my $remote_ip = $heap->{'remote_ip'};
-                       my $remote_port = $heap->{'remote_port'};
+                       daemon_log("$session_id WARNING: Cannot understand incoming msg from client '$msg_source'. Send ping-msg to cause a re-registering of the client if necessary", 3);
+                       #my $remote_ip = $heap->{'remote_ip'};
+                       #my $remote_port = $heap->{'remote_port'};
                        my $ping_msg = "<xml> <header>gosa_ping</header> <source>$server_address</source><target>$msg_source</target></xml>";
                        my ($test_error, $test_error_string) = &send_msg_to_target($ping_msg, "$msg_source", "dummy-key", "gosa_ping", $session_id);
+                       daemon_log("$session_id WARNING: sending msg to cause re-registering: $ping_msg", 3);
                }
+               else
+               {
+                       daemon_log("$session_id ERROR: incoming message contains no msg source. Processing aborted: $tmp_next_msg", 1);
+               }
+
                $error++;
        }