summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d2c3776)
raw | patch | inline | side by side (parent: d2c3776)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 19 Feb 2008 15:05:18 +0000 (15:05 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 19 Feb 2008 15:05:18 +0000 (15:05 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8961 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-server | patch | blob | history | |
gosa-si/modules/GosaPackages.pm | patch | blob | history |
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 590d9668e4a5a62e2d38a884aa684464a417ecdc..ea39ccfdd73889eeff8e50718848cab6d2591277 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
}
}
elsif( $answer_target eq "GOSA" ) {
- $answer =~ /<session_id>(\d)<\/session_id>/;
+ $answer =~ /<session_id>(\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
}
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;
index bcf8839490353ff2e2c228dbbd0b1d4087565d31..58791e9769b804b28bbf909950b0e477ce873f3c 100644 (file)
# 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
&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_//;
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 = "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><answer1>$res</answer1></xml>";
- 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 = "<xml><header>answer</header><source>$server_address</source><target>GOSA</target>";
my $len_db_res= keys %{$db_res};
-
for( my $i= 1; $i<= $len_db_res; $i++ ) {
$xml .= "\n<answer$i>";
my $hash= $db_res->{$i};
# 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;
}
my $count = keys(%{$res_hash});
$out_xml= "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><count>$count</count></xml>";
-
- return $out_xml;
+ my @out_msg_l = ( $out_xml );
+ return @out_msg_l;
}
# prepare xml answer
my $out_xml = "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><answer1>$res</answer1></xml>";
- return $out_xml;
+ my @out_msg_l = ( $out_xml );
+ return @out_msg_l;
}
if( $error == 0 ) {
$out_xml = "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><answer1>0</answer1></xml>";
}
-
- return $out_xml;
+ my @out_msg_l = ( $out_xml );
+ return @out_msg_l;
}
if( $error == 0) {
$out_xml = "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><answer1>0</answer1></xml>";
}
-
- return $out_xml;
+ my @out_msg_l = ( $out_xml );
+ return @out_msg_l;
}