Code

* gosa-si-server-nobus
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 30 May 2008 07:36:26 +0000 (07:36 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 30 May 2008 07:36:26 +0000 (07:36 +0000)
* under construction

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

gosa-si/debian/gosa-si-server.install
gosa-si/gosa-si-server-nobus
gosa-si/tests/client.php

index 920b87f380ffa3f24def1e7af8c0d9976ac99e9e..4a6fa4af7def072c074fc561dd47ba296f9ad8b3 100644 (file)
@@ -11,6 +11,7 @@ server/events/gosaTriggered.pm                  usr/lib/gosa-si/server/GosaPackages
 server/events/siTriggered.pm        usr/lib/gosa-si/server/ClientPackages
 server/events/clMessages.pm         usr/lib/gosa-si/server/ClientPackages
 server/events/databases.pm          usr/lib/gosa-si/server/GosaPackages
+server/events/databases.pm          usr/lib/gosa-si/server/ServerPackages
 server/events/krb5.pm               usr/lib/gosa-si/server/GosaPackages
 server/events/logHandling.pm        usr/lib/gosa-si/server/ClientPackages
 server/events/server_server_com.pm  usr/lib/gosa-si/server/ServerPackages
index ac627c6593a6363a70378531ff9ad8430a9eb4c0..6562c2e806919443ba69273056ed013186c44b5d 100755 (executable)
@@ -1079,6 +1079,9 @@ sub msg_to_decrypt {
         if (not $done) {
             if (($target eq $server_address) && (not exists $msg_hash->{'forward_to_gosa'})) {
                 $done = 1;
+                if ($source eq "GOSA") {
+                    $msg =~ s/<\/xml>/<forward_to_gosa>$server_address,$session_id<\/forward_to_gosa><\/xml>/;
+                }
                 print STDERR "target is own address without forward_to_gosa-tag -> process here\n";
             }
         }
@@ -1095,6 +1098,19 @@ sub msg_to_decrypt {
             }
         }
 
+        # target ist own address with forward_to_gosa-tag not pointing to myself -> process here
+        if (not $done) {
+            my $forward_to_gosa =  @{$msg_hash->{'forward_to_gosa'}}[0];
+            my $gosa_at;
+            my $gosa_session_id;
+            if (($target eq $server_address) && (defined $forward_to_gosa)){
+                my ($gosa_at, $gosa_session_id) = split(/,/, $forward_to_gosa);
+                if ($gosa_at ne $server_address) {
+                    $done = 1;
+                    print STDERR "target is own address with forward_to_gosa-tag not pointing to myself -> process here\n"; 
+                }
+            }
+        }
 
         # if message should be processed here -> add message to incoming_db
         if ($done) {
@@ -1110,25 +1126,25 @@ sub msg_to_decrypt {
 
         }
 
-        # target is own address with forward_to_gosa-tag -> forward to gosa
+        # target is own address with forward_to_gosa-tag pointing at myself -> forward to gosa
         if (not $done) {
             my $forward_to_gosa =  @{$msg_hash->{'forward_to_gosa'}}[0];
+            my $gosa_at;
+            my $gosa_session_id;
             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);
+                my ($gosa_at, $gosa_session_id) = split(/,/, $forward_to_gosa);
+                if ($gosa_at eq $server_address) {
+                    my $session_reference = $kernel->ID_id_to_session($gosa_session_id);
                     if( defined $session_reference ) {
                         $heap = $session_reference->get_heap();
                     }
-                #}
-                if(exists $heap->{'client'}) {
-                    $msg = &encrypt_msg($msg, $GosaPackages_key);
-                    $heap->{'client'}->put($msg);
+                    if(exists $heap->{'client'}) {
+                        $msg = &encrypt_msg($msg, $GosaPackages_key);
+                        $heap->{'client'}->put($msg);
+                    }
+                    $done = 1;
+                    print STDERR "target is own address with forward_to_gosa-tag pointing at myself -> forward to gosa\n";
                 }
-                $done = 1;
-                print STDERR "target is own address with forward_to_gosa-tag -> forward to gosa\n";
             }
 
         }
@@ -1147,7 +1163,7 @@ sub msg_to_decrypt {
                     $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>/;
+                        $msg =~ s/<\/xml>/<forward_to_gosa>$server_address,$session_id<\/forward_to_gosa><\/xml>/;
                     }
                     &send_msg_to_target($msg, $regserver, $regserver_key, $header, $session_id);
                 }
@@ -1162,10 +1178,19 @@ sub msg_to_decrypt {
             $res = $known_server_db->select_dbentry($sql);
             if (keys(%$res) > 0) {
                 my $hostkey = $res->{1}->{'hostkey'};
+
+                if ($source eq "GOSA") {
+                    $msg =~ s/<source>GOSA<\/source>/<source>$server_address<\/source>/;
+                    $msg =~ s/<\/xml>/<forward_to_gosa>$server_address,$session_id<\/forward_to_gosa><\/xml>/;
+
+                }
+
                 &send_msg_to_target($msg, $target, $hostkey, $header, $session_id);
                 $done = 1;
                 print STDERR "target is a server address -> forward to server\n";
             }
+
+
         }
 
         if (not $done) {
index 461ce429399b6957f56c41736c1b87dea590fe66..eec4b88642f3a6cf7f4b103f020d5e034f507c54 100755 (executable)
@@ -105,7 +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_query_fai_server</header><source>GOSA</source> <target>10.89.1.131:20081</target></xml>";
+    #$data = "<xml><header>gosa_query_fai_server</header><source>GOSA</source> <target>10.89.1.131:20081</target></xml>";
+    $data = "<xml><header>gosa_query_fai_server</header><source>GOSA</source> <target>10.89.1.31:20081</target></xml>";
     #$data = "<xml> <header>gosa_new_ping</header> <target>00:0c:29:02:e5:4d</target> <source>GOSA</source> </xml>";
 
     $sock->write($data);