From: rettenbe Date: Wed, 12 Mar 2008 10:26:35 +0000 (+0000) Subject: bugfix: comunication between gosa and gosa-si X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=87ff2196a00f7b5c5f4252530429fd94e8ebc9df;p=gosa.git bugfix: comunication between gosa and gosa-si git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9703 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/client/events/corefunctions.pm b/gosa-si/client/events/corefunctions.pm index 3f534088e..3d0311926 100644 --- a/gosa-si/client/events/corefunctions.pm +++ b/gosa-si/client/events/corefunctions.pm @@ -312,6 +312,11 @@ sub new_key { my $out_hash = &create_xml_hash("new_key", $main::client_address, $main::server_address, $new_server_key); my $out_msg = &create_xml_string($out_hash); + + # set global $NEW_KEY_FLAG, gosa-si-client cause a reregistering process if no 'confirm_new_key'-msg + # comes from gosa-si-server within a given time + + return $out_msg; } diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client index 359803d20..75424cef3 100755 --- a/gosa-si/gosa-si-client +++ b/gosa-si/gosa-si-client @@ -614,15 +614,15 @@ sub send_msg_to_target { # opensocket my $socket = &open_socket($address); if( !$socket ) { - daemon_log("cannot send ".$msg_header."msg to $address , host not reachable", 1); + daemon_log("ERROR: cannot send ".$msg_header."msg to $address , host not reachable", 1); $error++; } # send xml msg if( $error == 0 ) { print $socket $crypted_msg."\n"; - daemon_log("send ".$msg_header."msg to $address", 1); - daemon_log("message:\n$msg", 8); + daemon_log("INFO: send ".$msg_header."msg to $address", 5); + daemon_log("DEBUG: message:\n$msg", 8); } # close socket in any case @@ -930,6 +930,7 @@ sub trigger_new_key { &send_msg_to_target($msg, $client_address, $server_key, 'new_key'); $kernel->delay_set('trigger_new_key', $server_key_lifetime); + $kernel->delay_set('trigger_reregistering_process', 10); } @@ -960,6 +961,10 @@ sub trigger_logged_in_users_report { } } +sub trigger_reregistering_process { + $REGISTERED = 0; +} + sub generic_file_reset { my ( $heap, $wheel_id ) = @_[ HEAP, ARG0 ]; @@ -1086,11 +1091,11 @@ sub server_input { my $error = 0; my $answer; - daemon_log("Incoming msg:\n$input\n", 8); + daemon_log("DEBUG: Incoming msg:\n$input\n", 8); my ($msg, $msg_hash) = &check_key_and_xml_validity($input, $server_key); if( (!$msg) || (!$msg_hash) ) { - daemon_log("Deciphering of incoming msg failed", 5); + daemon_log("WARNING: Deciphering of incoming msg failed", 3); $error++; } @@ -1102,8 +1107,14 @@ sub server_input { my $source = @{$msg_hash->{source}}[0]; if( exists $event_hash->{$header} ) { + + # preprocessing + if($header eq "confirm_new_key") { + $kernel->delay_set() + } + # a event exists with the header as name - daemon_log("found event '$header' at event-module '".$event_hash->{$header}."'", 5); + daemon_log("DEBUG: found event '$header' at event-module '".$event_hash->{$header}."'", 7); no strict 'refs'; $answer = &{$event_hash->{$header}."::$header"}($msg, $msg_hash); } diff --git a/gosa-si/server/events/databases.pm b/gosa-si/server/events/databases.pm index d40ca0b8f..8f5648057 100644 --- a/gosa-si/server/events/databases.pm +++ b/gosa-si/server/events/databases.pm @@ -70,6 +70,7 @@ sub query_db { my $res_hash = $db->select_dbentry($sql_statement); my $out_xml = &db_res2si_msg($res_hash, $header, $target, $source); + $out_xml =~ s/<\/xml>/$session_id<\/session_id><\/xml>/; my @out_msg_l = ( $out_xml ); return @out_msg_l; } @@ -131,7 +132,7 @@ sub delete_jobdb_entry { } # prepare xml answer - my $out_xml = "
answer
$target$source$res
"; + my $out_xml = "
answer
$target$source$res$session_id
"; my @out_msg_l = ( $out_xml ); return @out_msg_l; @@ -153,7 +154,7 @@ sub clear_jobdb { if( not $db_res > 0 ) { $error++; }; if( $error == 0 ) { - $out_xml = "
answer
$target$source0
"; + $out_xml = "
answer
$target$source0$session_id
"; } my @out_msg_l = ( $out_xml ); return @out_msg_l; @@ -166,7 +167,7 @@ sub update_status_jobdb_entry { my $source = @{$msg_hash->{'source'}}[0]; my $error= 0; - my $out_xml= "
answer
$target$source1
"; + my $out_xml= "
answer
$target$source1$session_id
"; my @len_hash = keys %{$msg_hash}; if( 0 == @len_hash) { $error++; }; @@ -200,7 +201,7 @@ sub update_status_jobdb_entry { $out_xml = "0"; } - my $out_msg = sprintf("
answer
%s%s%s
", $target, $source, $out_xml); + my $out_msg = sprintf("
answer
%s%s%s$session_id
", $target, $source, $out_xml); my @out_msg_l = ( $out_msg ); return @out_msg_l; } diff --git a/gosa-si/tests/client.php b/gosa-si/tests/client.php index b43306e09..dbe43c173 100755 --- a/gosa-si/tests/client.php +++ b/gosa-si/tests/client.php @@ -35,18 +35,15 @@ if($sock->connected()){ #$data = "
gosa_update_status_jobdb_entry
GOSAGOSA 00:01:6c:9d:b9:fa processing update
"; # jobdb query -#$data = "
gosa_query_jobdb
GOSA GOSA". -# "andgt0le5
"; -#$data= "
gosa_query_jobdb
GOSA GOSA". -# "ping03
"; -#$data= "
gosa_query_jobdb
GOSA GOSA". -# "trigger_action_reinstall". -# "025timestamp DESC
"; -#$data= "
gosa_query_jobdb
GOSA GOSA
"; +#$data = "
gosa_query_jobdb
GOSA GOSAandgt0le5
"; +#$data= "
gosa_query_jobdb
GOSA GOSAping03
"; +#$data= "
gosa_query_jobdb
GOSA GOSAtrigger_action_reinstall025timestamp DESC
"; +$data= "
gosa_query_jobdb
GOSA GOSA
"; # jobdb count #$data = "
gosa_count_jobdb
GOSA GOSA
"; -$data = "
gosa_count_fai_server
GOSA GOSA
"; +#$data = "
gosa_count_fai_server
GOSA GOSA
"; +#$data = "
gosa_count_fai_release
GOSA GOSA
"; # jobdb clear #$data = "
gosa_clear_jobdb
GOSA GOSA
";