Code

* gosa-si-server-nobus
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 May 2008 13:11:54 +0000 (13:11 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 May 2008 13:11:54 +0000 (13:11 +0000)
* under construction

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11107 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/client/events/corefunctions.pm
gosa-si/gosa-si-server-nobus
gosa-si/modules/ServerPackages.pm
gosa-si/tests/client.php

index d14230fe2e089c770aa3bedb9832019c16124821..b9c32d0ae220e4613b00f83d93c14f58c5abf1f1 100644 (file)
@@ -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;
 
index e167e88f4d59afb75eb2ee6c7f16d15422f9ef4e..f46e82691f27025cd738fb97eed54a746194e0d0 100755 (executable)
@@ -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/<source>GOSA<\/source>/<source>$server_address<\/source>/;
                     $msg =~ s/<target>$target<\/target>/<target>$hostname<\/target>/;
+                    if ($source eq "GOSA") {
+                        $msg =~ s/<\/xml>/<forward_to_gosa>$session_id<\/forward_to_gosa><\/xml>/;
+                    }
                     &send_msg_to_target($msg, $regserver, $regserver_key, $header, $session_id);
                 }
                 $done = 1;
index 7ce04da8678258e27b2826f53a3f8e3d3c491d48..45492912e654135ce7ef8d7a060220bf5bc10bf7 100644 (file)
@@ -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/<header>gosa_(\w+)<\/header>|<header>job_(\w+)<\/header>/<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
index 4f30784e9c6ba1193517022413c23cb5fe0adb52..2be71dd8a91248863a06afc19cf085dda8cf8f0b 100755 (executable)
@@ -105,8 +105,8 @@ for($count = 1; $count <= $zahl; $count++)
     #$data = "<xml> <header>gosa_krb5_create_principal</header> <target>00:01:6c:9d:aa:16</target> <principal>horst@WIRECARD.SYS</principal><source>GOSA</source><max_life>666</max_life></xml>"; 
     #$data = "<xml> <header>gosa_krb5_modify_principal</header> <target>00:01:6c:9d:b9:fa</target> <principal>horst@WIRECARD.SYS</principal><source>GOSA</source><max_life>666</max_life></xml>"; 
 
-    $data = "<xml> <header>gosa_new_ping</header> <target>10.89.1.31:20083</target> <source>GOSA</source> <forward_to_gosa></forward_to_gosa> </xml>";
-    #$data = "<xml> <header>new_ping</header> <target>00:0c:29:02:e5:4d</target> <source>GOSA</source> </xml>";
+    #$data = "<xml> <header>gosa_new_ping</header> <target>10.89.1.31:20083</target> <source>GOSA</source> <forward_to_gosa></forward_to_gosa> </xml>";
+    $data = "<xml> <header>gosa_new_ping</header> <target>00:0c:29:02:e5:4d</target> <source>GOSA</source> </xml>";
 
     $sock->write($data);
     $answer = "nothing";