Code

Some more checks for valid input.
[gosa.git] / gosa-si / gosa-si-server
index a34e5c97cb43c061b496353f7d20dae4579acae6..515fe6ef25f90d093f34331d1b4c4dacac2d130c 100755 (executable)
@@ -331,18 +331,27 @@ sub import_modules {
         if (not $file =~ /(\S*?).pm$/) {
             next;
         }
+
+               if( $no_arp > 0 ) {
+                       if( $file =~ /ArpHandler.pm/ ) {
+                               next;
+                       }
+               } 
         eval { require $file; };
         if ($@) {
             daemon_log("ERROR: gosa-si-server could not load module $file", 1);
             daemon_log("$@", 5);
-        } else {
-            my $mod_name = $1;
-            my $info = eval($mod_name.'::get_module_info()');
-            my ($input_address, $input_key, $input, $input_active, $input_type) = @{$info};
-            $known_modules->{$mod_name} = $info;
-
-            daemon_log("module $mod_name loaded", 1);
-        }
+               } else {
+                       my $mod_name = $1;
+                       my $info = eval($mod_name.'::get_module_info()');
+
+                       # Only load module if get_module_info() returns a non-null object
+                       if(defined($info)) {
+                               my ($input_address, $input_key, $input, $input_active, $input_type) = @{$info};
+                               $known_modules->{$mod_name} = $info;
+                               daemon_log("module $mod_name loaded", 1);
+                       }
+               }
     }   
 
     # for debugging
@@ -396,6 +405,9 @@ sub create_known_client {
 
 sub client_input {
        my ($heap,$input,$wheel) = @_[HEAP, ARG0, ARG1];
+
+    daemon_log("Incoming msg:\n$input\n", 8);
+
        ######################################
        # forward msg to all imported modules 
        no strict "refs";
@@ -563,8 +575,7 @@ $known_server_db->create_table('known_server', \@server_col_names);
 # check wether all modules are gosa-si valid passwd check
 
 # create session for repeatedly checking the job queue for jobs
-POE::Session->create
-(
+POE::Session->create(
        inline_states => {
                _start => \&trigger_db_loop,
                watch_for_new_jobs => \&watch_for_new_jobs,
@@ -572,8 +583,7 @@ POE::Session->create
 );
 
 # create socket for incoming xml messages
-POE::Component::Server::TCP->new
-(
+POE::Component::Server::TCP->new(
        Port => $server_port,
        ClientInput => \&client_input,
 );