Code

fai msgs are forwarded into gosa jobqueue
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 20 Feb 2008 16:29:41 +0000 (16:29 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 20 Feb 2008 16:29:41 +0000 (16:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8996 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/debian/gosa-si-server.install
gosa-si/gosa-si-client
gosa-si/gosa-si-server
gosa-si/modules/GosaPackages.pm
gosa-si/modules/SIPackages.pm
gosa-si/tests/client.php

index d483ae2bbe6ff615d1de45d172a104e83b670d80..b30cc9ce1aa80b428a0cb8533407eb0a7dc17fed 100644 (file)
@@ -7,4 +7,4 @@ modules/GosaPackages.pm         usr/lib/gosa-si/modules
 modules/ArpHandler.pm          usr/lib/gosa-si/modules
 modules/oui.txt                        usr/lib/gosa-si/modules
 server/events/gosaTriggered.pm         usr/lib/gosa-si/server/events
-server/events/siTriggered.pm           usr/lib/gosa-si/server/events
+server/events/siTriggered.pm        usr/lib/gosa-si/server/events
index b4f6a4358f7a308dad3259669154cb1e90adad83..fee7b719953e8ad14f72305bc3163e4a4aadb622 100755 (executable)
@@ -1191,6 +1191,7 @@ sub fifo_got_record {
     }
 
     my $clmsg_hash = &create_xml_hash("CLMSG_$header", $client_address, $server_address, $content);
+    &add_content2xml_hash($clmsg_hash, "macaddress", $client_mac_address);
     my $clmsg = &create_xml_string($clmsg_hash);
     &send_msg_to_target($clmsg, $server_address, $server_key);
     return;
index 3bf04aff50ef16c21daf159e1a6f88c1e799e602..5e61e9a553ce107458d65cd9feb4bed940c9abe2 100755 (executable)
@@ -87,9 +87,9 @@ $bus_activ = "true";
 
 $no_arp = 0;
 
-# name of table for storing gosa jobs
-our $job_queue_table_name = 'jobs';
+# holds all gosa jobs
 our $job_db;
+our $job_queue_table_name = 'jobs';
 
 # holds all other gosa-sd as well as the gosa-sd-bus
 our $known_server_db;
@@ -459,6 +459,7 @@ sub check_outgoing_xml_validity {
                     $target =~ /^GOSA$/i ||
                     $target =~ /^\*$/ ||
                     $target =~ /KNOWN_SERVER/i ||
+                    $target =~ /JOBDB/i ||
                     $target =~ /^([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})$/i ){
                 die "target '$target' is not a complete ip-address with port or a valid target name or a mac-address";
             }
@@ -926,6 +927,8 @@ sub client_input {
 
             # deliver msg to all targets 
             foreach my $answer_target ( @answer_target_l ) {
+
+                # targets of msg are all gosa-si-clients in known_clients_db
                 if( $answer_target eq "*" ) {
                     # answer is for all clients
                     my $sql_statement= "SELECT * FROM known_clients";
@@ -936,19 +939,8 @@ sub client_input {
                         &send_msg_to_target($answer, $host_name, $host_key, $answer_header);
                     }
                 }
-                elsif( $answer_target eq "GOSA" ) {
-                    $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.$add_on;
-                }
+                # targets of msg are all gosa-si-server in known_server_db
                 elsif( $answer_target eq "KNOWN_SERVER" ) {
                     # answer is for all server in known_server
                     my $sql_statement= "SELECT * FROM known_server";
@@ -960,6 +952,29 @@ sub client_input {
                         &send_msg_to_target($answer, $host_name, $host_key, $answer_header);
                     }
                 }
+
+                # target of msg is GOsa
+                elsif( $answer_target eq "GOSA" ) {
+                    $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.$add_on;
+                }
+
+                # target of msg is job queue at this host
+                elsif( $answer_target eq "JOBDB") {
+                    $answer =~ /<header>(\S+)<\/header>/;   
+                    my $header;
+                    if( defined $1 ) { $header = $1; }
+                    &send_msg_to_target($answer, $server_address, $GosaPackages_key, $header);
+                }
+
+                # target of msg is a mac address
                 elsif( $answer_target =~ /^([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})$/i ) {
                     daemon_log("target is mac address '$answer_target', looking for host in known_clients", 3);
                     my $sql_statement = "SELECT * FROM known_clients WHERE macaddress='$answer_target'";
@@ -988,9 +1003,9 @@ sub client_input {
                         }
 
                     }
-                } else {
-                    # ... answer is for one specific host
 
+                #  answer is for one specific host   
+                } else {
                     # get encrypt_key
                     my $encrypt_key = &get_encrypt_key($answer_target);
                     if( not defined $encrypt_key ) {
index 1668c10fef1d316d3c9336f21933431b6eee7d23..e2e7b3fc357a43e8cd36eb2b177f564c71ebb480 100644 (file)
@@ -513,6 +513,9 @@ sub update_status_jobdb_entry {
         $out_xml = "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><answer1>0</answer1></xml>";
     }
     my @out_msg_l = ( $out_xml );
+
+print STDERR $out_xml."\n";
+
     return @out_msg_l;
 }
 
index 3d74d38b62dc57cef885b3aced89b2d9b5cb9f2c..c9231d2aae6f531453385fcbf73e36b1b29149d6 100644 (file)
@@ -445,6 +445,9 @@ sub process_incoming_msg {
     my $header = @{$msg_hash->{header}}[0]; 
     my @target_l = @{$msg_hash->{target}};
 
+    # skip PREFIX
+    $header =~ s/^CLMSG_//;
+
     &main::daemon_log("SIPackages: msg to process: $header", 3);
     &main::daemon_log("$msg", 8);
 
index e38d7173668b2b76f4eb3083d244b2267e8656b9..dbaeb8f3a05ce54a0f67fcb5d7230fd76908e94a 100755 (executable)
@@ -16,15 +16,15 @@ if($sock->connected()){
        /* Prepare a hunge bunch of data to be send */
 
 # add
-$data = "<xml> <header>gosa_network_completition</header> <source>GOSA</source><target>GOSA</target><hostname>ws-muc-2</hostname></xml>";
+#$data = "<xml> <header>gosa_network_completition</header> <source>GOSA</source><target>GOSA</target><hostname>ws-muc-2</hostname></xml>";
 #$data = "<xml> <header>job_sayHello</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
-#$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source> <target>10.89.1.155:20081</target><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
+#$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source> <target>10.89.1.155:20081</target><mac>00:01:6c:9d:b9:fa</mac> <timestamp>20130102133900</timestamp> </xml>";
 
 # delete
 #$data = "<xml> <header>gosa_delete_jobdb_entry</header><where><clause><phrase><id>3</id></phrase></clause></where></xml>";
 
 # update  
-#$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <where><clause><phrase> <status>waiting</status></phrase></clause> </where> <update><status>processing</status> <result>update</result></update></xml>";
+$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <where><clause><phrase> <status>waiting</status></phrase></clause> </where> <update><status>processing</status> <result>update</result></update></xml>";
 
 # query
 #$data = "<xml><header>gosa_query_jobdb</header><where><clause><connector>and</connector><phrase><operator>gt</operator><ROWID>0</ROWID></phrase><phrase><operator>le</operator><ROWID>5</ROWID></phrase></clause></where></xml>";