Code

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