X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-si%2Fgosa-si-server;h=40f1f4ae422669e2082e00216e081c5677948963;hb=5ae142f19cbcdcaf5533b0edd3e3655eb0284d59;hp=7fc04abdd7eefdb7e87ac7f61b3d1243253a0032;hpb=baec22aa8e54bd6d649a7fa0935cb1334d985770;p=gosa.git diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 7fc04abdd..40f1f4ae4 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -248,7 +248,7 @@ our $logged_in_user_date_of_expiry = 600; "job-queue-loop-delay" => [\$job_queue_loop_delay, 3], "messaging-db-loop-delay" => [\$messaging_db_loop_delay, 3], "key" => [\$GosaPackages_key, "none"], - "new-systems-ou" => [\$new_systems_ou, 'ou=systems'], + "new-systems-ou" => [\$new_systems_ou, 'ou=workstations,ou=systems'], }, "ClientPackages" => { "key" => [\$ClientPackages_key, "none"], @@ -696,42 +696,43 @@ sub input_from_known_client { sub input_from_unknown_host { - no strict "refs"; - my ($input, $session_id) = @_ ; - my ($msg, $msg_hash, $module); - my $error_string; - + no strict "refs"; + my ($input, $session_id) = @_ ; + my ($msg, $msg_hash, $module); + my $error_string; + my %act_modules = %$known_modules; - - while( my ($mod, $info) = each(%act_modules)) { - # check a key exists for this module - my $module_key = ${$mod."_key"}; - if( not defined $module_key ) { - if( $mod eq 'ArpHandler' ) { - next; - } - daemon_log("$session_id ERROR: no key specified in config file for $mod", 1); - next; - } - daemon_log("$session_id DEBUG: $mod: $module_key", 7); + while( my ($mod, $info) = each(%act_modules)) { - # check if module can open msg envelope with module key - ($msg, $msg_hash) = &check_key_and_xml_validity($input, $module_key, $session_id); - if( (not defined $msg) || (not defined $msg_hash) ) { - next; - } - else { - $module = $mod; - last; - } - } + # check a key exists for this module + my $module_key = ${$mod."_key"}; + if( not defined $module_key ) { + if( $mod eq 'ArpHandler' ) { + next; + } + daemon_log("$session_id ERROR: no key specified in config file for $mod", 1); + next; + } + daemon_log("$session_id DEBUG: $mod: $module_key", 7); - if( (!$msg) || (!$msg_hash) || (!$module)) { - daemon_log("$session_id DEBUG: Incoming message is not from an unknown host", 7); - } + # check if module can open msg envelope with module key + ($msg, $msg_hash) = &check_key_and_xml_validity($input, $module_key, $session_id); + if( (not defined $msg) || (not defined $msg_hash) ) { + daemon_log("$session_id ERROR: no msg returned!", 2) if ((not defined $msg) || "" eq $msg); + daemon_log("$session_id ERROR: no msg_hash returned!", 2) if ((not defined $msg_hash) || "" eq $msg_hash); + next; + } else { + $module = $mod; + last; + } + } - return ($msg, $msg_hash, $module); + if( (!$msg) || (!$msg_hash) || (!$module)) { + daemon_log("$session_id DEBUG: Incoming message is not from an unknown host", 7); + } + + return ($msg, $msg_hash, $module); } @@ -1717,6 +1718,17 @@ sub watch_for_new_jobs { # Skip new jobs for host if there is a processing job if(defined($res) and defined @{$res}[0]) { + # Prevent race condition if there is a trigger_activate job waiting and a goto-activation job processing + my $row = @{$res}[0] if (ref $res eq 'ARRAY'); + if(@{$row}[5] eq 'trigger_action_reinstall') { + my $sql_statement_2 = "SELECT * FROM $job_queue_tn WHERE macaddress LIKE '$macaddress' AND status='waiting' AND headertag = 'trigger_activate_new'"; + my $res_2 = $job_db->exec_statement( $sql_statement_2 ); + if(defined($res_2) and defined @{$res_2}[0]) { + # Set status from goto-activation to 'waiting' and update timestamp + $job_db->exec_statement("UPDATE $job_queue_tn SET status='waiting' WHERE macaddress LIKE '$macaddress' AND headertag = 'trigger_action_reinstall'"); + $job_db->exec_statement("UPDATE $job_queue_tn SET timestamp='".&get_time(30)."' WHERE macaddress LIKE '$macaddress' AND headertag = 'trigger_action_reinstall'"); + } + } next; }