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