1 package TestModule;
3 use Exporter;
4 @ISA = ("Exporter");
6 use strict;
7 use warnings;
8 use GosaSupportDaemon;
9 use utf8;
11 BEGIN{
12 }
14 END{}
16 ### START ##########
19 sub get_module_tags {
21 # lese config file aus dort gibt es eine section Basic
22 # dort stehen drei packettypen, für die sich das modul anmelden kann, gosa-admin-packages,
23 # server-packages, client-packages
24 my %tag_hash = (gosa_admin_packages => "yes",
25 server_packages => "yes",
26 client_packages => "yes",
27 );
28 return \%tag_hash;
29 }
32 sub process_incoming_msg {
33 my ($crypted_msg) = @_ ;
34 if(not defined $crypted_msg) {
35 &main::daemon_log("function 'process_incoming_msg': got no msg", 7);
36 }
37 &main::daemon_log("TestModule: crypted_msg:$crypted_msg", 7);
38 &main::daemon_log("TestModule: crypted_msg len:".length($crypted_msg), 7);
41 # chomp address from host who send the message
42 $crypted_msg =~ /^([\s\S]*?)\.(\d{1,3}?)\.(\d{1,3}?)\.(\d{1,3}?)\.(\d{1,3}?)$/;
43 $crypted_msg = $1;
44 my $host = sprintf("%s.%s.%s.%s", $2, $3, $4, $5);
46 my $gosa_passwd = $main::gosa_passwd;
47 my $gosa_cipher = &create_ciphering($gosa_passwd);
49 my $in_msg;
50 my $in_hash;
51 eval{
52 $in_msg = &decrypt_msg($crypted_msg, $gosa_cipher);
53 $in_hash = &transform_msg2hash($in_msg);
54 };
55 if ($@) {
56 &main::daemon_log("TestModul konnte msg nicht entschlüsseln:", 5);
57 &main::daemon_log("$@", 7);
58 return;
59 }
61 my $header = @{$in_hash->{header}}[0];
62 my $ip_address = @{$in_hash->{target}}[0];
65 # hier kommt die logik suche den entsprechenden daemon, der den client target hat
67 my $out_hash = &create_xml_hash("halt", $main::server_address, $ip_address);
69 &send_msg_hash2address($out_hash, $ip_address);
71 &main::daemon_log("TestModul: ip $ip_address bekommt $header ");
72 return ;
73 }