summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ff69122)
raw | patch | inline | side by side (parent: ff69122)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 28 Jul 2008 14:56:56 +0000 (14:56 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 28 Jul 2008 14:56:56 +0000 (14:56 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12072 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/client/events/mailqueue.pm | [new file with mode: 0644] | patch | blob |
gosa-si/gosa-si-server | patch | blob | history | |
gosa-si/modules/GosaPackages.pm | patch | blob | history | |
gosa-si/server/events/mailqueue_com.pm | [new file with mode: 0644] | patch | blob |
gosa-si/tests/client.php | patch | blob | history |
diff --git a/gosa-si/client/events/mailqueue.pm b/gosa-si/client/events/mailqueue.pm
--- /dev/null
@@ -0,0 +1,384 @@
+package mailqueue;
+use Exporter;
+@ISA = qw(Exporter);
+my @events = (
+ "get_events",
+ "mailqueue_query",
+ "mailqueue_hold",
+ "mailqueue_unhold",
+ "mailqueue_requeue",
+ "mailqueue_del",
+ "mailqueue_header",
+ );
+@EXPORT = @events;
+
+use strict;
+use warnings;
+use GOSA::GosaSupportDaemon;
+use Data::Dumper;
+
+BEGIN {}
+
+END {}
+
+
+sub get_events { return \@events; }
+
+sub mailqueue_query {
+ my ($msg, $msg_hash) = @_;
+ my $header = @{$msg_hash->{'header'}}[0];
+ my $source = @{$msg_hash->{'source'}}[0];
+ my $target = @{$msg_hash->{'target'}}[0];
+ my $session_id = @{$msg_hash->{'session_id'}}[0];
+ my $error = 0;
+ my $error_string;
+ my $msg_id;
+ my $msg_hold;
+ my $msg_size;
+ my $arrival_time;
+ my $sender;
+ my $recipient;
+ my $out_hash;
+ my $out_msg;
+
+ &main::daemon_log("DEBUG: run /usr/bin/mailq\n", 7);
+ my $result = qx("/usr/bin/mailq");
+ my @result_l = split(/([0-9A-Z]{10})/, $result);
+
+ if (length($result) == 0) {
+ $error = 1;
+ $error_string = "/usr/bin/mailq has no result";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ }
+
+ my $result_collection = {};
+ if (not $error) {
+ # parse information
+ my $result_length = @result_l;
+ my $j = 0;
+ for (my $i = 1; $i < $result_length; $i+=2) {
+ $j++;
+ $result_collection->{$j} = {};
+
+ $msg_id = $result_l[$i];
+ $result_collection->{$j}->{'msg_id'} = $msg_id;
+ $result_l[$i+1] =~ /^([\!| ])\s+(\d+) (\w{3} \w{3} \d+ \d+:\d+:\d+)\s+([\w.-]+@[\w.-]+)\s+/ ;
+ $result_collection->{$j}->{'msg_hold'} = $1 eq "!" ? 1 : 0 ;
+ $result_collection->{$j}->{'msg_size'} = $2;
+ $result_collection->{$j}->{'arrival_time'} = $3;
+ $result_collection->{$j}->{'sender'} = $4;
+ my @info_l = split(/\n/, $result_l[$i+1]);
+ $result_collection->{$j}->{'recipient'} = $info_l[2] =~ /([\w.-]+@[\w.-]+)/ ? $1 : 'unknown' ;
+ }
+ }
+
+ # create outgoing msg
+ $out_hash = &main::create_xml_hash("answer_$session_id", $target, $source);
+ &add_content2xml_hash($out_hash, "session_id", $session_id);
+ &add_content2xml_hash($out_hash, "error", $error);
+ if (defined @{$msg_hash->{'forward_to_gosa'}}[0]){
+ &add_content2xml_hash($out_hash, "forward_to_gosa", @{$msg_hash->{'forward_to_gosa'}}[0]);
+ }
+
+ # add error infos to outgoing msg
+ if ($error) {
+ &add_content2xml_hash($out_hash, "error_string", $error_string);
+ $out_msg = &main::create_xml_string($out_hash);
+
+ # add mail infos to outgoing msg
+ } else {
+ my $collection_string = &db_res2xml($result_collection);
+ $out_msg = &main::create_xml_string($out_hash);
+ $out_msg =~ s/<\/xml>/$collection_string<\/xml>/
+ }
+
+ return $out_msg;
+
+}
+
+sub mailqueue_hold {
+ my ($msg, $msg_hash) = @_;
+ my $header = @{$msg_hash->{'header'}}[0];
+ my $source = @{$msg_hash->{'source'}}[0];
+ my $target = @{$msg_hash->{'target'}}[0];
+ my $session_id = @{$msg_hash->{'session_id'}}[0];
+ my $error = 0;
+ my $error_string;
+
+ # sanity check of input
+ if (not exists $msg_hash->{'msg_id'}) {
+ $error_string = "Message doesn't contain a XML tag 'msg_id";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ $error = 1;
+ } elsif (ref @{$msg_hash->{'msg_id'}}[0] eq "HASH") {
+ $error_string = "XML tag 'msg_id' is empty";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ $error = 1;
+ }
+
+ if (not $error) {
+ my @msg_ids = @{$msg_hash->{'msg_id'}};
+ foreach my $msg_id (@msg_ids) {
+ my $error = 0; # clear error status
+
+ # sanity check of each msg_id
+ if (not $msg_id =~ /^[0-9A-Z]{10}$/) {
+ $error = 1;
+ $error_string = "message ID is not valid ([0-9A-Z]{10}) : $msg_id";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ }
+
+ if (not $error) {
+ my $cmd = "/usr/sbin/postsuper -h $msg_id 2>&1";
+ &main::daemon_log("DEBUG: run $cmd", 7);
+ my $result = qx($cmd);
+ if ($result =~ /^postsuper: ([0-9A-Z]{10}): placed on hold/ ) {
+ &main::daemon_log("INFO: Mail $msg_id placed on hold", 5);
+ } elsif ($result eq "") {
+ &main::daemon_log("INFO: Mail $msg_id is alread placed on hold", 5);
+
+ } else {
+ &main::daemon_log("ERROR: '$cmd' failed : $result", 1);
+ }
+ }
+ }
+ }
+
+ return;
+}
+
+
+sub mailqueue_unhold {
+ my ($msg, $msg_hash) = @_;
+ my $header = @{$msg_hash->{'header'}}[0];
+ my $source = @{$msg_hash->{'source'}}[0];
+ my $target = @{$msg_hash->{'target'}}[0];
+ my $session_id = @{$msg_hash->{'session_id'}}[0];
+ my $error = 0;
+ my $error_string;
+
+ # sanity check of input
+ if (not exists $msg_hash->{'msg_id'}) {
+ $error_string = "Message doesn't contain a XML tag 'msg_id'";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ $error = 1;
+ } elsif (ref @{$msg_hash->{'msg_id'}}[0] eq "HASH") {
+ $error_string = "XML tag 'msg_id' is empty";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ $error = 1;
+ }
+
+ if (not $error) {
+ my @msg_ids = @{$msg_hash->{'msg_id'}};
+ foreach my $msg_id (@msg_ids) {
+ my $error = 0; # clear error status
+
+ # sanity check of each msg_id
+ if (not $msg_id =~ /^[0-9A-Z]{10}$/) {
+ $error = 1;
+ $error_string = "message ID is not valid ([0-9A-Z]{10}) : $msg_id";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ }
+
+ if (not $error) {
+ my $cmd = "/usr/sbin/postsuper -H $msg_id 2>&1";
+ &main::daemon_log("DEBUG: run $cmd\n", 7);
+ my $result = qx($cmd);
+ if ($result =~ /^postsuper: ([0-9A-Z]{10}): released from hold/ ) {
+ &main::daemon_log("INFO: Mail $msg_id released from on hold", 5);
+ } elsif ($result eq "") {
+ &main::daemon_log("INFO: Mail $msg_id is alread released from hold", 5);
+
+ } else {
+ &main::daemon_log("ERROR: '$cmd' failed : $result", 1);
+ }
+
+ }
+ }
+ }
+
+ return;
+}
+
+sub mailqueue_requeue {
+ my ($msg, $msg_hash) = @_;
+ my $header = @{$msg_hash->{'header'}}[0];
+ my $source = @{$msg_hash->{'source'}}[0];
+ my $target = @{$msg_hash->{'target'}}[0];
+ my $session_id = @{$msg_hash->{'session_id'}}[0];
+ my @msg_ids = @{$msg_hash->{'msg_id'}};
+ my $error = 0;
+ my $error_string;
+
+ # sanity check of input
+ if (not exists $msg_hash->{'msg_id'}) {
+ $error_string = "Message doesn't contain a XML tag 'msg_id'";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ $error = 1;
+ } elsif (ref @{$msg_hash->{'msg_id'}}[0] eq "HASH") {
+ $error_string = "XML tag 'msg_id' is empty";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ $error = 1;
+ }
+
+ if (not $error) {
+ my @msg_ids = @{$msg_hash->{'msg_id'}};
+ foreach my $msg_id (@msg_ids) {
+ my $error = 0; # clear error status
+
+ # sanity check of each msg_id
+ if (not $msg_id =~ /^[0-9A-Z]{10}$/) {
+ $error = 1;
+ $error_string = "message ID is not valid ([0-9A-Z]{10}) : $msg_id";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ }
+
+ if (not $error) {
+ my $cmd = "/usr/sbin/postsuper -r $msg_id 2>&1";
+ &main::daemon_log("DEBUG: run '$cmd'", 7);
+ my $result = qx($cmd);
+ if ($result =~ /^postsuper: ([0-9A-Z]{10}): requeued/ ) {
+ &main::daemon_log("INFO: Mail $msg_id requeued", 5);
+ } elsif ($result eq "") {
+ &main::daemon_log("WARNING: Cannot requeue mail '$msg_id', mail not found!", 3);
+
+ } else {
+ &main::daemon_log("ERROR: '$cmd' failed : $result", 1);
+ }
+
+ }
+ }
+ }
+
+ return;
+}
+
+sub mailqueue_del {
+ my ($msg, $msg_hash) = @_;
+ my $header = @{$msg_hash->{'header'}}[0];
+ my $source = @{$msg_hash->{'source'}}[0];
+ my $target = @{$msg_hash->{'target'}}[0];
+ my $session_id = @{$msg_hash->{'session_id'}}[0];
+ my @msg_ids = @{$msg_hash->{'msg_id'}};
+ my $error = 0;
+ my $error_string;
+
+ # sanity check of input
+ if (not exists $msg_hash->{'msg_id'}) {
+ $error_string = "Message doesn't contain a XML tag 'msg_id'";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ $error = 1;
+ } elsif (ref @{$msg_hash->{'msg_id'}}[0] eq "HASH") {
+ $error_string = "XML tag 'msg_id' is empty";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ $error = 1;
+ }
+
+ if (not $error) {
+ my @msg_ids = @{$msg_hash->{'msg_id'}};
+ foreach my $msg_id (@msg_ids) {
+ my $error = 0; # clear error status
+
+ # sanity check of each msg_id
+ if (not $msg_id =~ /^[0-9A-Z]{10}$/) {
+ $error = 1;
+ $error_string = "message ID is not valid ([0-9A-Z]{10}) : $msg_id";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ }
+
+ if (not $error) {
+ my $cmd = "/usr/sbin/postsuper -d $msg_id 2>&1";
+ &main::daemon_log("DEBUG: run '$cmd'", 7);
+ my $result = qx($cmd);
+ if ($result =~ /^postsuper: ([0-9A-Z]{10}): removed/ ) {
+ &main::daemon_log("INFO: Mail $msg_id deleted", 5);
+ } elsif ($result eq "") {
+ &main::daemon_log("WARNING: Cannot remove mail '$msg_id', mail not found!", 3);
+
+ } else {
+ &main::daemon_log("ERROR: '$cmd' failed : $result", 1);
+ }
+
+ }
+ }
+ }
+
+ return;
+}
+
+sub mailqueue_header {
+ my ($msg, $msg_hash) = @_;
+ my $header = @{$msg_hash->{'header'}}[0];
+ my $source = @{$msg_hash->{'source'}}[0];
+ my $target = @{$msg_hash->{'target'}}[0];
+ my $session_id = @{$msg_hash->{'session_id'}}[0];
+ my $error = 0;
+ my $error_string;
+ my $sender;
+ my $recipient;
+ my $subject;
+ my $out_hash;
+ my $out_msg;
+
+ # sanity check of input
+ if (not exists $msg_hash->{'msg_id'}) {
+ $error_string = "Message doesn't contain a XML tag 'msg_id'";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ $error = 1;
+ } elsif (ref @{$msg_hash->{'msg_id'}}[0] eq "HASH") {
+ $error_string = "XML tag 'msg_id' is empty";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ $error = 1;
+ }
+
+ # sanity check of each msg_id
+ my $msg_id;
+ if (not $error) {
+ $msg_id = @{$msg_hash->{'msg_id'}}[0];
+ if (not $msg_id =~ /^[0-9A-Z]{10}$/) {
+ $error = 1;
+ $error_string = "message ID is not valid ([0-9A-Z]{10}) : $msg_id";
+ &main::daemon_log("ERROR: $error_string : $msg", 1);
+ }
+ }
+
+ # parsing information
+ if (not $error) {
+ my $cmd = "postcat -q $msg_id";
+ &main::daemon_log("DEBUG: run '$cmd'", 7);
+ my $result = qx($cmd);
+ foreach (split(/\n/, $result)) {
+ if ($_ =~ /^To: ([\S]+)/) { $recipient = $1; }
+ if ($_ =~ /^From: ([\S]+)/) { $sender = $1; }
+ if ($_ =~ /^Subject: ([\s\S]+)/) { $subject = $1; }
+ }
+ }
+
+ # create outgoing msg
+ $out_hash = &main::create_xml_hash("answer_$session_id", $target, $source);
+ &add_content2xml_hash($out_hash, "session_id", $session_id);
+ &add_content2xml_hash($out_hash, "error", $error);
+ if (defined @{$msg_hash->{'forward_to_gosa'}}[0]){
+ &add_content2xml_hash($out_hash, "forward_to_gosa", @{$msg_hash->{'forward_to_gosa'}}[0]);
+ }
+
+ # add error infos to outgoing msg
+ if ($error) {
+ &add_content2xml_hash($out_hash, "error_string", $error_string);
+ $out_msg = &main::create_xml_string($out_hash);
+
+ # add mail infos to outgoing msg
+ } else {
+ &add_content2xml_hash($out_hash, "recipient", $recipient);
+ &add_content2xml_hash($out_hash, "sender", $sender);
+ &add_content2xml_hash($out_hash, "subject", $subject);
+ $out_msg = &main::create_xml_string($out_hash);
+ }
+
+ return $out_msg;
+}
+
+
+# vim:ts=4:shiftwidth:expandtab
+
+1;
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index ada883ba08d8c225d9040d5cb39a4217c8586dd2..e377f705d63696c7879d290b76b396dda349e5f0 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
$GosaPackages_key, $gosa_ip, $gosa_port, $gosa_timeout,
$foreign_server_string, $server_domain, $ServerPackages_key, $foreign_servers_register_delay,
$wake_on_lan_passwd, $job_synchronization, $modified_jobs_loop_delay,
+ $arp_enabled, $arp_interface,
);
# additional variable which should be globaly accessable
"key-lifetime" => [\$foreign_servers_register_delay, 120],
"job-synchronization-enabled" => [\$job_synchronization, "true"],
"synchronization-loop" => [\$modified_jobs_loop_delay, 5],
-}
+ },
+"ArpHandler" => {
+ "enabled" => [\$arp_enabled, "true"],
+ "interface" => [\$arp_interface, "all"],
+ },
+
);
}
my $mod_name = $1;
+ # ArpHandler switch
if( $file =~ /ArpHandler.pm/ ) {
- if( $no_arp > 0 ) {
- next;
- }
+ if( $arp_enabled eq "false" ) { next; }
}
eval { require $file; };
index 5791a318eb9fd1d4392f6e43b2da8793fc700782..ad5d12b504a7d3ecbf14c1d1b48c71ecbcdde1c7 100644 (file)
if (defined $out_msg){
push(@out_msg_l, $out_msg);
}
-
}
return \@out_msg_l;
my @out_msg_l = ('nohandler');
my $sql_events;
+ # strip gosa_ prefix from header, it is not used any more
+ @{$msg_hash->{'header'}}[0] =~ s/gosa_//;
+ $msg =~ s/<header>gosa_/<header>/;
+
my $header = @{$msg_hash->{'header'}}[0];
my $target = @{$msg_hash->{'target'}}[0];
- $header =~ s/gosa_//;
# check local installed events
if( exists $event_hash->{$header} ) {
# client is registered for this event, deliver this message to client
if ($client_events =~ /,$header,/) {
- $msg =~ s/<header>gosa_/<header>/;
@out_msg_l = ( $msg );
# client is not registered for this event, set error
diff --git a/gosa-si/server/events/mailqueue_com.pm b/gosa-si/server/events/mailqueue_com.pm
--- /dev/null
@@ -0,0 +1,171 @@
+package mailqueue_com;
+use Exporter;
+@ISA = qw(Exporter);
+my @events = (
+ "get_events",
+ "mailqueue_query",
+ "mailqueue_header",
+);
+@EXPORT = @events;
+
+use strict;
+use warnings;
+use GOSA::GosaSupportDaemon;
+use Data::Dumper;
+use Time::HiRes qw( usleep);
+use MIME::Base64;
+
+
+BEGIN {}
+
+END {}
+
+### Start ######################################################################
+
+sub get_events {
+ return \@events;
+}
+
+sub mailqueue_query {
+ my ($msg, $msg_hash, $session_id) = @_ ;
+ my $header = @{$msg_hash->{header}}[0];
+ my $target = @{$msg_hash->{target}}[0];
+ my $source = @{$msg_hash->{source}}[0];
+ my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+ my $error = 0;
+ my $error_string;
+ my $answer_msg;
+ my ($sql, $res);
+
+ if( defined $jobdb_id) {
+ my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id";
+ &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+ my $res = $main::job_db->exec_statement($sql_statement);
+ }
+
+ # send message
+ $sql = "SELECT * FROM $main::known_clients_tn WHERE ((hostname='$target') || (macaddress LIKE '$target'))";
+ $res = $main::known_clients_db->exec_statement($sql);
+
+ # sanity check of db result
+ my ($host_name, $host_key);
+ if ((defined $res) && (@$res > 0) && @{@$res[0]} > 0) {
+ $host_name = @{@$res[0]}[0];
+ $host_key = @{@$res[0]}[2];
+ } else {
+ &main::daemon_log("$session_id ERROR: cannot determine host_name and host_key from known_clients_db\n$msg", 1);
+ $error_string = "Cannot determine host_name and host_key from known_clients_db";
+ $error = 1;
+ }
+
+ if (not $error) {
+ $msg =~ s/<source>GOSA<\/source>/<source>$main::server_address<\/source>/g;
+ $msg =~ s/<\/xml>/<session_id>$session_id<\/session_id><\/xml>/;
+ &main::send_msg_to_target($msg, $host_name, $host_key, $header, $session_id);
+
+ # waiting for answer
+ my $message_id;
+ my $i = 0;
+ while (1) {
+ $i++;
+ $sql = "SELECT * FROM $main::incoming_tn WHERE headertag='answer_$session_id'";
+ $res = $main::incoming_db->exec_statement($sql);
+ if (ref @$res[0] eq "ARRAY") {
+ $message_id = @{@$res[0]}[0];
+ last;
+ }
+
+ if ($i > 100) { last; } # do not run into a endless loop
+ usleep(100000);
+ }
+ # if answer exists
+ if (defined $message_id) {
+ $answer_msg = decode_base64(@{@$res[0]}[4]);
+ $answer_msg =~ s/<target>\S+<\/target>/<target>$source<\/target>/;
+ $answer_msg =~ s/<header>\S+<\/header>/<header>$header<\/header>/;
+
+ my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
+ if (defined $forward_to_gosa){
+ $answer_msg =~s/<\/xml>/<forward_to_gosa>$forward_to_gosa<\/forward_to_gosa><\/xml>/;
+ }
+ $sql = "DELETE FROM $main::incoming_tn WHERE id=$message_id";
+ $res = $main::incoming_db->exec_statement($sql);
+ }
+ }
+
+ return ( $answer_msg );
+}
+
+sub mailqueue_header {
+ my ($msg, $msg_hash, $session_id) = @_ ;
+ my $header = @{$msg_hash->{header}}[0];
+ my $target = @{$msg_hash->{target}}[0];
+ my $source = @{$msg_hash->{source}}[0];
+ my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+ my $error = 0;
+ my $error_string;
+ my $answer_msg;
+ my ($sql, $res);
+
+ if( defined $jobdb_id) {
+ my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id";
+ &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+ my $res = $main::job_db->exec_statement($sql_statement);
+ }
+
+ # search for the correct target address
+ $sql = "SELECT * FROM $main::known_clients_tn WHERE ((hostname='$target') || (macaddress LIKE '$target'))";
+ $res = $main::known_clients_db->exec_statement($sql);
+ my ($host_name, $host_key);
+ if ((defined $res) && (@$res > 0) && @{@$res[0]} > 0) { # sanity check of db result
+ $host_name = @{@$res[0]}[0];
+ $host_key = @{@$res[0]}[2];
+ } else {
+ &main::daemon_log("$session_id ERROR: cannot determine host_name and host_key from known_clients_db\n$msg", 1);
+ $error_string = "Cannot determine host_name and host_key from known_clients_db";
+ $error = 1;
+ }
+
+ # send message to target
+ if (not $error) {
+ $msg =~ s/<source>GOSA<\/source>/<source>$main::server_address<\/source>/g;
+ $msg =~ s/<\/xml>/<session_id>$session_id<\/session_id><\/xml>/;
+ &main::send_msg_to_target($msg, $host_name, $host_key, $header, $session_id);
+ }
+
+ # waiting for answer
+ if (not $error) {
+ my $message_id;
+ my $i = 0;
+ while (1) {
+ $i++;
+ $sql = "SELECT * FROM $main::incoming_tn WHERE headertag='answer_$session_id'";
+ $res = $main::incoming_db->exec_statement($sql);
+ if (ref @$res[0] eq "ARRAY") {
+ $message_id = @{@$res[0]}[0];
+ last;
+ }
+
+ if ($i > 100) { last; } # do not run into a endless loop
+ usleep(100000);
+ }
+ # if answer exists
+ if (defined $message_id) {
+ $answer_msg = decode_base64(@{@$res[0]}[4]);
+ $answer_msg =~ s/<target>\S+<\/target>/<target>$source<\/target>/;
+ $answer_msg =~ s/<header>\S+<\/header>/<header>$header<\/header>/;
+
+ my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
+ if (defined $forward_to_gosa){
+ $answer_msg =~s/<\/xml>/<forward_to_gosa>$forward_to_gosa<\/forward_to_gosa><\/xml>/;
+ }
+ $sql = "DELETE FROM $main::incoming_tn WHERE id=$message_id";
+ $res = $main::incoming_db->exec_statement($sql);
+ }
+ }
+
+ return ( $answer_msg );
+}
+
+# vim:ts=4:shiftwidth:expandtab
+1;
index 7737ff0e21f57dafea9532ed0e8ad40e8e5720f2..4c507336f077bc7075b2bbc8601b11d1fdbe5e20 100755 (executable)
--- a/gosa-si/tests/client.php
+++ b/gosa-si/tests/client.php
#$data = "<xml> <header>gosa_opsi_get_netboot_products</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> <hostId>limux-cl-2.intranet.gonicus.de</hostId></xml>";
# Get all localboot products
- $data = "<xml> <header>gosa_opsi_get_local_products</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> </xml>";
+ #$data = "<xml> <header>gosa_opsi_get_local_products</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> </xml>";
# Get localboot product for specific host
#$data = "<xml> <header>gosa_opsi_get_local_products</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> <hostId>limux-cl-2.intranet.gonicus.de</hostId></xml>";
# Get product properties - global
- $data = "<xml> <header>gosa_opsi_get_product_properties</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> <ProductId>winxppro</ProductId></xml>";
+ #$data = "<xml> <header>gosa_opsi_get_product_properties</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> <ProductId>winxppro</ProductId></xml>";
# Get product properties - per host
#$data = "<xml> <header>gosa_opsi_get_product_properties</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> <ProductId>firefox</ProductId> <hostId>limux-cl-2.intranet.gonicus.de</hostId> </xml>";
#$data = "<xml> <header>gosa_opsi_list_clients</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> </xml>";
# Delete Opsi client
- $data = "<xml> <header>gosa_opsi_del_client</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> <hostId>sdfgsg.intranet.gonicus.de</hostId></xml>";
+ #$data = "<xml> <header>gosa_opsi_del_client</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> <hostId>sdfgsg.intranet.gonicus.de</hostId></xml>";
+
+ #########################
+ # Mailqueue communication
+ $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>";
+ #$data = "<xml> <header>gosa_mailqueue_unhold</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <msg_id>5657EBEEF7</msg_id> </xml>";
+ #$data = "<xml> <header>gosa_mailqueue_requeue</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <msg_id>11A09BEF04</msg_id> </xml>";
+ #$data = "<xml> <header>gosa_mailqueue_del</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <msg_id>11A09BEF04</msg_id> </xml>";
+
+ # only one xml tag msg_id is allowed
+ #$data = "<xml> <header>gosa_mailqueue_header</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <msg_id>99E92BEF2B</msg_id> </xml>";
+
+
+
$sock->write($data);
$answer = "nothing";