Code

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

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11099 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 1e7717f12a0a2b5526fdb3fd95d60c37f5cb1362..d14230fe2e089c770aa3bedb9832019c16124821 100644 (file)
@@ -498,12 +498,21 @@ sub new_ping {
     my $source = @{$msg_hash->{'source'}}[0];
     my $target = @{$msg_hash->{'target'}}[0];
     my $session_id = @{$msg_hash->{'session_id'}}[0];
+    my $out_msg;
+    my $out_hash;
+
+    # there is no session_id so send 'got_new_ping'-msg
+    if (not defined $session_id) {
+        $out_hash = &main::create_xml_hash("got_new_ping", $target, $source);
+
+    # there is a session_id so send 'answer_$session_id'-msg because there is 
+    # a process waiting for this message
+    } else {
+        $out_hash = &main::create_xml_hash("answer_$session_id", $target, $source);
+        &add_content2xml_hash($out_hash, "session_id", $session_id);
+    }
 
-   
-    # switch target and source and send msg back
-    my $out_hash = &main::create_xml_hash("answer_$session_id", $target, $source);
-    &add_content2xml_hash($out_hash, "session_id", $session_id);
-    my $out_msg = &main::create_xml_string($out_hash);
+    $out_msg = &main::create_xml_string($out_hash);
     return $out_msg;
 
 }
index e87b7dbc198465bad787ab200068b5d0ac4a7acc..e167e88f4d59afb75eb2ee6c7f16d15422f9ef4e 100755 (executable)
@@ -1077,7 +1077,9 @@ sub msg_to_decrypt {
             $sql = "SELECT * FROM $known_clients_tn WHERE (hostname='$target' OR macaddress LIKE '$target')"; 
             $res = $known_clients_db->select_dbentry($sql);
             if (keys(%$res) > 0) {
-                $done = 1;
+                $done = 1; 
+                my $hostname = $res->{1}->{'hostname'};
+                $msg =~ s/<target>$target<\/target>/<target>$hostname<\/target>/;
                 print STDERR "target is a client address in known_clients -> process here\n";
             }
         }
@@ -1123,12 +1125,14 @@ sub msg_to_decrypt {
             $sql = "SELECT * FROM $foreign_clients_tn WHERE (hostname='$target' OR macaddress LIKE '$target')";
             $res = $foreign_clients_db->select_dbentry($sql);
             if (keys(%$res) > 0) {
+                my $hostname = $res->{1}->{'hostname'};
                 my $regserver = $res->{1}->{'regserver'};
                 my $sql = "SELECT * FROM $known_server_tn WHERE hostname='$regserver'"; 
                 my $res = $known_server_db->select_dbentry($sql);
                 if (keys(%$res) > 0) {
                     my $regserver_key = $res->{1}->{'hostkey'};
                     $msg =~ s/<source>GOSA<\/source>/<source>$server_address<\/source>/;
+                    $msg =~ s/<target>$target<\/target>/<target>$hostname<\/target>/;
                     &send_msg_to_target($msg, $regserver, $regserver_key, $header, $session_id);
                 }
                 $done = 1;
index 25adebdc91589524866a31e442a6c9e1c62b3912..820ccc2586f790b0791625465c630a745b53d1e2 100644 (file)
@@ -52,6 +52,7 @@ sub process_incoming_msg {
     my $header = @{$msg_hash->{header}}[0];
     my $source = @{$msg_hash->{source}}[0]; 
     my $target = @{$msg_hash->{target}}[0];
+    my $sql_events;
 
     my @msg_l;
     my @out_msg_l;
@@ -103,7 +104,7 @@ sub process_incoming_msg {
         @out_msg_l = ();
     }
       
-    return @out_msg_l;
+    return \@out_msg_l;
 }
 
 1;
index 135bb44a1a25d8f2863f6003ebcee4d9bb798364..4f30784e9c6ba1193517022413c23cb5fe0adb52 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>new_ping</header> <target>10.89.1.131: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>new_ping</header> <target>00:0c:29:02:e5:4d</target> <source>GOSA</source> </xml>";
 
     $sock->write($data);
     $answer = "nothing";