From: rettenbe Date: Tue, 19 Feb 2008 15:05:18 +0000 (+0000) Subject: bugfix X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=937a00c39c4d769606efd0b525cdcfc06331553e;p=gosa.git bugfix git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8961 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 590d9668e..ea39ccfdd 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -950,11 +950,17 @@ sub client_input { } } elsif( $answer_target eq "GOSA" ) { - $answer =~ /(\d)<\/session_id>/; + $answer =~ /(\d+)<\/session_id>/; + my $session_id = $1; + my $add_on = ""; + if( defined $session_id ) { + $add_on = ".session_id=$session_id"; + } + # answer is for GOSA and has to returned to connected client my $gosa_answer = &encrypt_msg($answer, $GosaPackages_key); - $client_answer = $gosa_answer."session_id=$1"; + $client_answer = $gosa_answer.$add_on; } elsif( $answer_target eq "KNOWN_SERVER" ) { # answer is for all server in known_server @@ -1028,17 +1034,14 @@ sub client_input { } if( $client_answer ) { - - if( $client_answer =~ /session_id=(\d+)/ ) { + if( $client_answer =~ s/session_id=(\d+)$// ) { my $session_id = $1; - my $session_reference = $kernel->ID_id_to_session($1); - my $session_heap = $session_reference->get_heap(); - $session_heap->{client}->put( $client_answer ); + if( defined $session_id ) { + my $session_reference = $kernel->ID_id_to_session($session_id); + $heap = $session_reference->get_heap(); + } } - else { - $heap->{client}->put($client_answer); - } - + $heap->{client}->put($client_answer); } return; diff --git a/gosa-si/modules/GosaPackages.pm b/gosa-si/modules/GosaPackages.pm index bcf883949..58791e976 100644 --- a/gosa-si/modules/GosaPackages.pm +++ b/gosa-si/modules/GosaPackages.pm @@ -303,20 +303,20 @@ sub process_gosa_msg { # decide wether msg is a core function or a event handler if ( $header eq 'query_jobdb') { - $out_msg = &query_jobdb + @out_msg_l = &query_jobdb } elsif ($header eq 'delete_jobdb_entry') { - $out_msg = &delete_jobdb_entry + @out_msg_l = &delete_jobdb_entry } elsif ($header eq 'clear_jobdb') { - $out_msg = &clear_jobdb + @out_msg_l = &clear_jobdb } elsif ($header eq 'update_status_jobdb_entry' ) { - $out_msg = &update_status_jobdb_entry + @out_msg_l = &update_status_jobdb_entry } elsif ($header eq 'count_jobdb' ) { - $out_msg = &count_jobdb - } elsif ($header eq 'trigger_action_wake' ) { - # Forward messages to all known servers as "trigger_wake" - my $in_hash= &transform_msg2hash($msg); - my %data = ( 'macAddress' => \@{$in_hash->{macAddress}} ); - $out_msg = &build_msg("trigger_wake", $server_address, "KNOWN_SERVER", \%data); + @out_msg_l = &count_jobdb +# } elsif ($header eq 'trigger_action_wake' ) { +# # Forward messages to all known servers as "trigger_wake" +# my $in_hash= &transform_msg2hash($msg); +# my %data = ( 'macAddress' => \@{$in_hash->{macAddress}} ); +# @out_msg_l = &build_msg("trigger_wake", $server_address, "KNOWN_SERVER", \%data); } else { # msg could not be assigned to core function # maybe it is an eventa @@ -333,19 +333,15 @@ sub process_gosa_msg { &main::daemon_log("ERROR: GosaPackages: no event handler or core function defined for $header", 1); } elsif( 0 == @out_msg_l) { &main::daemon_log("ERROR: GosaPackages got not answer from event_handler $header", 1); - } elsif( $out_msg ) { - push(@out_msg_l, $out_msg); - } + } return @out_msg_l; - } sub process_job_msg { my ($msg, $msg_hash)= @_ ; my $out_msg; - my @out_msg_l; my $header = @{$msg_hash->{header}}[0]; $header =~ s/job_//; @@ -367,26 +363,21 @@ sub process_job_msg { my $res = $main::job_db->add_dbentry($func_dic); if (not $res == 0) { &main::daemon_log("ERROR: GosaPackages: process_job_msg: $res", 1); - } - else { + } else { &main::daemon_log("INFO: GosaPackages: $header job successfully added to job queue", 5); } $out_msg = "
answer
$server_addressGOSA$res
"; - push( @out_msg_l, $out_msg ); - + my @out_msg_l = ( $out_msg ); return @out_msg_l; - } sub db_res_2_xml { my ($db_res) = @_ ; - my $xml = "
answer
$server_addressGOSA"; my $len_db_res= keys %{$db_res}; - for( my $i= 1; $i<= $len_db_res; $i++ ) { $xml .= "\n"; my $hash= $db_res->{$i}; @@ -427,8 +418,8 @@ sub query_jobdb { # execute db query my $res_hash = $main::job_db->select_dbentry($sql_statement); my $out_xml = &db_res_2_xml($res_hash); - - return $out_xml; + my @out_msg_l = ( $out_xml ); + return @out_msg_l; } @@ -445,8 +436,8 @@ sub count_jobdb { my $count = keys(%{$res_hash}); $out_xml= "
answer
$server_addressGOSA$count
"; - - return $out_xml; + my @out_msg_l = ( $out_xml ); + return @out_msg_l; } @@ -471,7 +462,8 @@ sub delete_jobdb_entry { # prepare xml answer my $out_xml = "
answer
$server_addressGOSA$res
"; - return $out_xml; + my @out_msg_l = ( $out_xml ); + return @out_msg_l; } @@ -491,8 +483,8 @@ sub clear_jobdb { if( $error == 0 ) { $out_xml = "
answer
$server_addressGOSA0
"; } - - return $out_xml; + my @out_msg_l = ( $out_xml ); + return @out_msg_l; } @@ -523,8 +515,8 @@ sub update_status_jobdb_entry { if( $error == 0) { $out_xml = "
answer
$server_addressGOSA0
"; } - - return $out_xml; + my @out_msg_l = ( $out_xml ); + return @out_msg_l; }