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