From: rettenbe Date: Thu, 29 May 2008 08:09:31 +0000 (+0000) Subject: * gosa-si-server-nobus X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=52f1c740d80740ccbcd7b2c7fbe3dedc10af9d9b;p=gosa.git * gosa-si-server-nobus * under construction git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11096 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server-nobus b/gosa-si/gosa-si-server-nobus index dc94baaba..e87b7dbc1 100755 --- a/gosa-si/gosa-si-server-nobus +++ b/gosa-si/gosa-si-server-nobus @@ -1223,11 +1223,6 @@ sub process_task { if( $error == 0) { daemon_log("$session_id INFO: Incoming msg (session_id=$session_id) with header '".@{$msg_hash->{'header'}}[0]."'", 5); daemon_log("$session_id DEBUG: Processing module ".$module, 7); - - known_modules - } - - if ($error == 0) { $answer_l = &{ $module."::process_incoming_msg" }($msg, $msg_hash, $session_id); if ( 0 < @{$answer_l} ) { diff --git a/gosa-si/modules/GosaPackages.pm b/gosa-si/modules/GosaPackages.pm index 8f0e76eea..2986f3b29 100644 --- a/gosa-si/modules/GosaPackages.pm +++ b/gosa-si/modules/GosaPackages.pm @@ -346,10 +346,10 @@ sub process_gosa_msg { @out_msg_l = (); } elsif ($out_msg_l[0] eq 'knownclienterror') { &main::daemon_log("$session_id ERROR: no or more than 1 hits are found at known_clients_db with sql query: '$sql_events'", 1); - &main::daemon_log("$session_id WARNING: processing is aborted and message will not be forwarded"); + &main::daemon_log("$session_id WARNING: processing is aborted and message will not be forwarded", 3); @out_msg_l = (); } elsif ($out_msg_l[0] eq 'noeventerror') { - &main::daemon_log("$session_id WARNING: client '$target' is not registered for event '$header', processing is aborted", 1); + &main::daemon_log("$session_id WARNING: client '$target' is not registered for event '$header', processing is aborted", 3); @out_msg_l = (); } diff --git a/gosa-si/modules/ServerPackages.pm b/gosa-si/modules/ServerPackages.pm index 8e6427345..25adebdc9 100644 --- a/gosa-si/modules/ServerPackages.pm +++ b/gosa-si/modules/ServerPackages.pm @@ -51,7 +51,7 @@ sub process_incoming_msg { my ($msg, $msg_hash, $session_id) = @_ ; my $header = @{$msg_hash->{header}}[0]; my $source = @{$msg_hash->{source}}[0]; - my @target_l = @{$msg_hash->{target}}; + my $target = @{$msg_hash->{target}}[0]; my @msg_l; my @out_msg_l; @@ -62,11 +62,47 @@ sub process_incoming_msg { &main::daemon_log("$session_id INFO: found event '$header' at event-module '".$event_hash->{$header}."'", 5); no strict 'refs'; @out_msg_l = &{$event_hash->{$header}."::$header"}($msg, $msg_hash, $session_id); + } else { - &main::daemon_Log("$session_id ERROR: ServerPackages: no event handler defined for '$header'", 1); - @out_msg_l = (); + $sql_events = "SELECT * FROM $main::known_clients_tn WHERE ( (macaddress LIKE '$target') OR (hostname='$target') )"; + my $res = $main::known_clients_db->select_dbentry( $sql_events ); + my $l = keys(%$res); + + # set error if no or more than 1 hits are found for sql query + if ( $l != 1) { + @out_msg_l = ('knownclienterror'); + + # found exact 1 hit in db + } else { + my $client_events = $res->{'1'}->{'events'}; + + # client is registered for this event, deliver this message to client + if ($client_events =~ /,$header,/) { + $msg =~ s/
gosa_/
/; + @out_msg_l = ( $msg ); + + # client is not registered for this event, set error + } else { + @out_msg_l = ('noeventerror'); + } + } } + # if delivery not possible raise error and return + if (not defined $out_msg_l[0]) { + @out_msg_l = (); + } elsif ($out_msg_l[0] eq 'nohandler') { + &main::daemon_log("$session_id ERROR: ServerPackages: no event handler defined for '$header'", 1); + @out_msg_l = (); + } elsif ($out_msg_l[0] eq 'knownclienterror') { + &main::daemon_log("$session_id ERROR: no or more than 1 hits are found at known_clients_db with sql query: '$sql_events'", 1); + &main::daemon_log("$session_id WARNING: processing is aborted and message will not be forwarded", 3); + @out_msg_l = (); + } elsif ($out_msg_l[0] eq 'noeventerror') { + &main::daemon_log("$session_id WARNING: client '$target' is not registered for event '$header', processing is aborted", 3); + @out_msg_l = (); + } + return @out_msg_l; }