Code

bugfix: si server addressing with mac address is not allowed
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 4 Sep 2008 13:05:37 +0000 (13:05 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 4 Sep 2008 13:05:37 +0000 (13:05 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12365 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server
gosa-si/server/events/gosaTriggered.pm
gosa-si/tests/client.php

index c1fe2d63f0c36e389eab2db1954d5fa3d4d7bf9e..231fa016a91e12c6e92e76ca2a12760ca5e33696 100755 (executable)
@@ -1066,7 +1066,7 @@ sub msg_to_decrypt {
                } else {
             $local_address = $server_address;
         }
-        
+
         # Determine the local mac address if target is a mac address
         if ($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) {
             my $loc_ip = &get_local_ip_for_remote_ip($heap->{'remote_ip'});
index 0fe1127b261fcb425645ed3736ccd2befff84ac5..16bfcee52d45fb8dcf52d814b02ccd97ea951bbf 100644 (file)
@@ -1151,14 +1151,20 @@ sub get_hosts_with_module {
         &add_content2xml_hash($out_hash, "host", $local_mac);
     }
 
+    
+    my $out_msg = &create_xml_string($out_hash);
+
     # Search for opsi hosts in server_db
     my $sql = "SELECT * FROM $main::known_server_tn WHERE loaded_modules LIKE '%$module_name%'"; 
     my $res = $main::known_server_db->select_dbentry($sql);
     while (my ($hit_id, $hit_hash) = each %$res) {
-        &add_content2xml_hash($out_hash, "host", $hit_hash->{'macaddress'});
+        $out_msg =~ s/<\/xml>/<result>host$hit_id<\/result> <\/xml>/;
+        my $host_infos = "<ip>".$hit_hash->{'hostname'}."</ip>";
+        $host_infos .= " <mac>".$hit_hash->{'macaddress'}."</mac>"; 
+        $out_msg =~  s/<\/xml>/\n<host$hit_id> $host_infos <\/host$hit_id> \n <\/xml>/;
     }
 
-    return (&create_xml_string($out_hash));
+    return $out_msg;
 }
 
 
index 302370acc3d8ab51a3d2fdab2db35c8d1a8626ac..c5e2b51a33633c2f5cd2704019c06ec29c00d75b 100755 (executable)
@@ -77,7 +77,7 @@ for($count = 1; $count <= $zahl; $count++)
     #$data = "<xml> <header>gosa_get_client_for_login_usr</header> <target>GOSA</target> <source>GOSA</source> <usr>rettenbe</usr></xml>";
 
     # List all si-server providing opsi
-    #$data = "<xml> <header>gosa_get_hosts_with_module</header> <source>GOSA</source> <target>10.3.67.111:20081</target> <module_name>mailqueue_com</module_name> </xml>";
+    #$data = "<xml> <header>gosa_get_hosts_with_module</header> <source>GOSA</source> <target>10.89.1.31:20081</target> <module_name>mailqueue_com</module_name> </xml>";
 
     ##################
     # recreate fai dbs
@@ -178,11 +178,11 @@ for($count = 1; $count <= $zahl; $count++)
     
     # writing data into a mailqueue
     #$data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <subject>".base64_encode("eine wichtige nachricht")."</subject> <from>admin</from>  <user>polle</user> <user>harald</user> <delivery_time>20130101235959</delivery_time> <message>".base64_encode("kaffeepause")."</message> </xml>"; 
-    #$data = "<xml> <header>gosa_send_user_msg</header> <target>00:01:6c:9d:aa:16</target> <source>GOSA</source> <subject>".base64_encode("eine wichtige nachricht")."</subject> <from>admin</from> <user>polle</user> <user>harald</user> <delivery_time>20130101235959</delivery_time> <message>".base64_encode("kaffeepause")."</message> </xml>";
-    #$data = "<xml> <header>gosa_send_user_msg</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> <subject>".base64_encode("eine wichtige nachricht")."</subject> <from>admin</from> <user>polle</user> <user>harald</user> <delivery_time>20130101235959</delivery_time> <message>".base64_encode("kaffeepause")."</message> </xml>";
+    #$data = "<xml> <header>gosa_send_user_msg</header> <target>10.89.1.30:20081</target> <source>GOSA</source> <subject>".base64_encode("eine wichtige nachricht")."</subject> <from>admin</from> <user>polle</user> <user>harald</user> <delivery_time>20130101235959</delivery_time> <message>".base64_encode("kaffeepause")."</message> </xml>";
+    $data = "<xml> <header>gosa_send_user_msg</header> <target>10.89.1.30:20081</target> <source>GOSA</source> <subject>".base64_encode("eine wichtige nachricht")."</subject> <from>admin</from> <user>polle</user> <user>harald</user> <delivery_time>20130101235959</delivery_time> <message>".base64_encode("kaffeepause")."</message> </xml>";
 
     #$data = "<xml> <header>gosa_mailqueue_query</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> </xml>";
-    $data = "<xml> <header>gosa_mailqueue_query</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> </xml>";
+    #$data = "<xml> <header>gosa_mailqueue_query</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> </xml>";
 
     # multiple xml tags msg_id are allowed
     #$data = "<xml> <header>gosa_mailqueue_hold</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <msg_id>99C8ABEF23</msg_id> </xml>";