From: rettenbe Date: Wed, 12 Nov 2008 13:28:42 +0000 (+0000) Subject: * reregistering between client and server works again X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f970ba2c0742d5ad248674f3ba5d95745bd0cfe5;p=gosa.git * reregistering between client and server works again * ticket #1587 git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13008 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client index 83ff2b2b4..3504850f2 100755 --- a/gosa-si/gosa-si-client +++ b/gosa-si/gosa-si-client @@ -429,6 +429,10 @@ sub send_msg_to_target { if( $msg_header ) { $msg_header = "'$msg_header'-"; } else { $msg_header = ""; } + # Memorize own source address + $msg =~ /(\S+)<\/source>/; + my $own_source_address = $1; + # encrypt xml msg my $crypted_msg = &encrypt_msg($msg, $encrypt_key); @@ -447,7 +451,7 @@ sub send_msg_to_target { # send xml msg if( $error == 0 ) { - print $socket $crypted_msg."\n"; + print $socket $crypted_msg.";$own_source_address\n"; daemon_log("INFO: send ".$msg_header."msg to $address", 5); daemon_log("DEBUG: message:\n$msg", 9); } diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index fcb6da378..cfb2542ee 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -1014,7 +1014,10 @@ sub update_jobdb_status_for_send_msgs { "SET status='error', result='can not deliver msg, please consult log file' ". "WHERE id=$jobdb_id"; my $res = $job_db->update_dbentry($sql_statement); +<<<<<<< .mine +======= &daemon_log("$session_id DEBUG: $sql_statement", 7); +>>>>>>> .r13007 } # sending msg was successful @@ -1074,11 +1077,10 @@ sub msg_to_decrypt { my ($msg, $msg_hash, $module); my $error = 0; - # hole neue msg aus @msgs_to_decrypt - my $next_msg = shift @msgs_to_decrypt; + # fetch new msg out of @msgs_to_decrypt + my $tmp_next_msg = shift @msgs_to_decrypt; + my ($next_msg, $msg_source) = split(/;/, $tmp_next_msg); - # entschlüssle sie - # msg is from a new client or gosa ($msg, $msg_hash, $module) = &input_from_unknown_host($next_msg, $session_id); # msg is from a gosa-si-server @@ -1091,23 +1093,16 @@ sub msg_to_decrypt { } # an error occurred if(( !$msg ) || ( !$msg_hash ) || ( !$module )){ - # if an incoming msg could not be decrypted (maybe a wrong key), send client a ping. If the client - # could not understand a msg from its server the client cause a re-registering process - daemon_log("$session_id WARNING cannot understand incoming msg, send 'ping'-msg to all host with ip '".$heap->{remote_ip}. - "' to cause a re-registering of the client if necessary", 3); - my $sql_statement = "SELECT * FROM $main::known_clients_tn WHERE (hostname LIKE '".$heap->{'remote_ip'}."%')"; - my $query_res = $known_clients_db->select_dbentry( $sql_statement ); - while( my ($hit_num, $hit) = each %{ $query_res } ) { - my $host_name = $hit->{'hostname'}; - my $host_key = $hit->{'hostkey'}; - my $ping_msg = "
gosa_ping
$server_address $host_name
"; - my $error = &send_msg_to_target($ping_msg, $host_name, $host_key, "gosa_ping", $session_id); - &update_jobdb_status_for_send_msgs($session_id, $ping_msg, $error); - } - $error++; + # if an incoming msg could not be decrypted (maybe a wrong key), send client a ping. If the client + # could not understand a msg from its server the client cause a re-registering process + my $ping_msg = "
gosa_ping
$server_address$msg_source
"; + 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 cannot understand incoming msg, send 'ping'-msg to all host with ip '".$heap->{remote_ip}. + "' to cause a re-registering of the client if necessary", 3); + $error++; } - my $header; my $target; my $source;