From: rettenbe Date: Thu, 29 May 2008 13:11:54 +0000 (+0000) Subject: * gosa-si-server-nobus X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6c9134c152c28aebe59a507781790ab5c5a43dc4;p=gosa.git * gosa-si-server-nobus * under construction git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11107 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/client/events/corefunctions.pm b/gosa-si/client/events/corefunctions.pm index d14230fe2..b9c32d0ae 100644 --- a/gosa-si/client/events/corefunctions.pm +++ b/gosa-si/client/events/corefunctions.pm @@ -497,6 +497,7 @@ sub new_ping { my $header = @{$msg_hash->{'header'}}[0]; my $source = @{$msg_hash->{'source'}}[0]; my $target = @{$msg_hash->{'target'}}[0]; + my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0]; my $session_id = @{$msg_hash->{'session_id'}}[0]; my $out_msg; my $out_hash; @@ -512,6 +513,9 @@ sub new_ping { &add_content2xml_hash($out_hash, "session_id", $session_id); } + if (defined $forward_to_gosa) { + &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa); + } $out_msg = &main::create_xml_string($out_hash); return $out_msg; diff --git a/gosa-si/gosa-si-server-nobus b/gosa-si/gosa-si-server-nobus index e167e88f4..f46e82691 100755 --- a/gosa-si/gosa-si-server-nobus +++ b/gosa-si/gosa-si-server-nobus @@ -1056,6 +1056,7 @@ sub msg_to_decrypt { my $header; my $target; + my $source; my $done = 0; my $sql; my $res; @@ -1063,6 +1064,8 @@ sub msg_to_decrypt { if ($error == 0) { $header = @{$msg_hash->{'header'}}[0]; $target = @{$msg_hash->{'target'}}[0]; + $source = @{$msg_hash->{'source'}}[0]; + # target is own address without forward_to_gosa-tag -> process here if (not $done) { @@ -1100,16 +1103,17 @@ sub msg_to_decrypt { # target is own address with forward_to_gosa-tag -> forward to gosa if (not $done) { - if (($target eq $server_address) && (exists $msg_hash->{'forward_to_gosa'})){ - if( $msg =~ s/session_id=(\d+)$// ) { - my $session_id = $1 ; - } - if( defined $session_id ) { - my $session_reference = $kernel->ID_id_to_session($session_id); + my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0]; + if (($target eq $server_address) && (defined $forward_to_gosa)){ + #if( $msg =~ s/session_id=(\d+)$// ) { + # my $session_id = $1 ; + #} + #if( defined $session_id ) { + my $session_reference = $kernel->ID_id_to_session($forward_to_gosa); if( defined $session_reference ) { $heap = $session_reference->get_heap(); } - } + #} if(exists $heap->{'client'}) { $msg = &encrypt_msg($msg, $GosaPackages_key); $heap->{'client'}->put($msg); @@ -1133,6 +1137,9 @@ sub msg_to_decrypt { my $regserver_key = $res->{1}->{'hostkey'}; $msg =~ s/GOSA<\/source>/$server_address<\/source>/; $msg =~ s/$target<\/target>/$hostname<\/target>/; + if ($source eq "GOSA") { + $msg =~ s/<\/xml>/$session_id<\/forward_to_gosa><\/xml>/; + } &send_msg_to_target($msg, $regserver, $regserver_key, $header, $session_id); } $done = 1; diff --git a/gosa-si/modules/ServerPackages.pm b/gosa-si/modules/ServerPackages.pm index 7ce04da86..45492912e 100644 --- a/gosa-si/modules/ServerPackages.pm +++ b/gosa-si/modules/ServerPackages.pm @@ -58,6 +58,12 @@ sub process_incoming_msg { my @msg_l; my @out_msg_l = ( 'nohandler' ); + + # if message is being forwarded from another server, strip of header prefixes + $header =~ s/^gosa_|job_//; + $msg =~ s/
gosa_(\w+)<\/header>|
job_(\w+)<\/header>/
$1<\/header>/; + + &main::daemon_log("$session_id DEBUG: ServerPackages: msg to process '$header'", 7); if( exists $event_hash->{$header} ) { # a event exists with the header as name diff --git a/gosa-si/tests/client.php b/gosa-si/tests/client.php index 4f30784e9..2be71dd8a 100755 --- a/gosa-si/tests/client.php +++ b/gosa-si/tests/client.php @@ -105,8 +105,8 @@ for($count = 1; $count <= $zahl; $count++) #$data = "
gosa_krb5_create_principal
00:01:6c:9d:aa:16 horst@WIRECARD.SYSGOSA666
"; #$data = "
gosa_krb5_modify_principal
00:01:6c:9d:b9:fa horst@WIRECARD.SYSGOSA666
"; - $data = "
gosa_new_ping
10.89.1.31:20083 GOSA
"; - #$data = "
new_ping
00:0c:29:02:e5:4d GOSA
"; + #$data = "
gosa_new_ping
10.89.1.31:20083 GOSA
"; + $data = "
gosa_new_ping
00:0c:29:02:e5:4d GOSA
"; $sock->write($data); $answer = "nothing";