From: rettenbe Date: Mon, 3 Nov 2008 08:25:19 +0000 (+0000) Subject: fixes some bugs in several files X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=06b73bad92611031124e512a6c8f4382b17bc58d;p=gosa.git fixes some bugs in several files git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12861 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 22986304d..371fc8a6e 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -1261,6 +1261,9 @@ sub msg_to_decrypt { && $not_found_in_known_server_db && $not_found_in_known_clients_db) { &daemon_log("$session_id DEBUG: target is not in foreign_clients_db, known_server_db or known_clients_db, maybe it is a complete new one -> process here", 7); + if ($header =~ /^gosa_/ || $header =~ /^job_/) { + $module = "GosaPackages"; + } my $res = $incoming_db->add_dbentry( {table=>$incoming_tn, primkey=>[], headertag=>$header, @@ -1831,7 +1834,7 @@ sub watch_for_new_messages { my %receiver_h; foreach my $receiver (@message_to_l) { if ($receiver =~ /^u_([\s\S]*)$/) { - $receiver_h{$1} = 0; + $receiver_h{$receiver} = 0; } elsif ($receiver =~ /^g_([\s\S]*)$/) { my $group_name = $1; # fetch all group members from ldap and add them to receiver hash @@ -1921,9 +1924,10 @@ sub watch_for_delivery_messages { #&daemon_log("0 DEBUG: $sql", 7); my $res = $login_users_db->exec_statement($sql); - # reciver is logged in nowhere + # receiver is logged in nowhere if (not ref(@$res[0]) eq "ARRAY") { next; } + # receiver ist logged in at a client registered at local server my $send_succeed = 0; foreach my $hit (@$res) { my $receiver_host = @$hit[0]; diff --git a/gosa-si/server/events/clMessages.pm b/gosa-si/server/events/clMessages.pm index 0e9c69b96..5f23c351a 100644 --- a/gosa-si/server/events/clMessages.pm +++ b/gosa-si/server/events/clMessages.pm @@ -119,7 +119,7 @@ sub LOGIN { my $res; my $error_str; - # Invoke set_last_system + # Invoke set_last_system; message sets ldap attributes 'gotoLastSystemLogin' and 'gotoLastSystem' $res = &set_last_system($msg, $msg_hash, $session_id); my %add_hash = ( table=>$main::login_users_tn, @@ -174,7 +174,7 @@ sub CURRENTLY_LOGGED_IN { return; } - # Invoke set_last_system + # Invoke set_last_system; message sets ldap attributes 'gotoLastSystemLogin' and 'gotoLastSystem' my $res = &set_last_system($msg, $msg_hash, $session_id); # fetch all user currently assigned to the client at login_users_db @@ -230,12 +230,17 @@ sub CURRENTLY_LOGGED_IN { &main::daemon_log("$session_id INFO: delete user '".$hit->{'user'}."' at client '".$hit->{'client'}."' from login_user_db", 5); } + # TODO + # Inform all other server which users are logged in at clients registered at local server + + # sende allen anderen server eine nachricht, "foreign_user_updates" zum beispiel + return; } ## @method set_last_system() -# @details Message set ldap attributes 'gotoLastSystemLogin' and 'gotoLastSystem' +# @details Message sets ldap attributes 'gotoLastSystemLogin' and 'gotoLastSystem' # @param msg - STRING - xml message with tag 'last_system_login' and 'last_system' # @param msg_hash - HASHREF - message information parsed into a hash # @param session_id - INTEGER - POE session id of the processing of this message @@ -387,7 +392,7 @@ sub GOTOACTIVATION { $header =~ s/CLMSG_//g; my $sql_statement = "UPDATE $main::job_queue_tn ". - "SET status='processing', progress='goto-activation', modified='1' ". + "SET progress='goto-activation', modified='1' ". "WHERE status='processing' AND macaddress LIKE '$macaddress'"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->update_dbentry($sql_statement); diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index 5e1a08478..e62c86a26 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -95,7 +95,7 @@ sub send_user_msg { # keep job queue uptodate if necessary my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -157,7 +157,7 @@ sub recreate_fai_server_db { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -177,7 +177,7 @@ sub recreate_fai_release_db { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -197,7 +197,7 @@ sub recreate_packages_list_db { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -218,7 +218,7 @@ sub get_login_usr_for_client { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -245,7 +245,7 @@ sub get_client_for_login_usr { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -276,7 +276,7 @@ sub ping { my ($sql, $res); if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -292,10 +292,6 @@ sub ping { $host_key = @{@$res[0]}[2]; } else { &main::daemon_log("$session_id ERROR: cannot determine host_name and host_key from known_clients_db at function ping\n$msg", 1); - my %data = ( 'answer_xml' => 'host not found in known_clients_db', - 'macaddress' => $target, - ); - $answer_msg = &build_msg("got_ping_error", $main::server_address, $source, \%data); $error = 1; } @@ -396,7 +392,7 @@ sub detect_hardware { my $target = @{$msg_hash->{target}}[0]; my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -422,7 +418,7 @@ sub trigger_reload_syslog_config { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -445,7 +441,7 @@ sub trigger_reload_ntp_config { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -463,7 +459,7 @@ sub trigger_reload_ldap_config { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -485,7 +481,7 @@ sub set_activated_for_installation { # update status of job my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -533,7 +529,7 @@ sub trigger_action_lock { &main::change_goto_state('locked', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -551,7 +547,7 @@ sub trigger_action_activate { &main::change_goto_state('active', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -572,7 +568,7 @@ sub trigger_action_localboot { &main::change_fai_state('localboot', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -588,7 +584,7 @@ sub trigger_action_halt { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -605,7 +601,7 @@ sub trigger_action_reboot { &main::change_fai_state('reboot', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -622,7 +618,7 @@ sub trigger_action_memcheck { &main::change_fai_state('memcheck', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -638,7 +634,7 @@ sub trigger_action_reinstall { &main::change_fai_state('reinstall', \@{$msg_hash->{macaddress}}, $session_id); - my %data = ( 'macAddress' => \@{$msg_hash->{macaddress}} ); + my %data = ( 'macaddress' => \@{$msg_hash->{macaddress}} ); my $wake_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data); # invoke trigger wake for this gosa-si-server &main::server_server_com::trigger_wake($msg, $msg_hash, $session_id); @@ -654,7 +650,7 @@ sub trigger_action_update { &main::change_fai_state('update', \@{$msg_hash->{macaddress}}, $session_id); - my %data = ( 'macAddress' => \@{$msg_hash->{macaddress}} ); + my %data = ( 'macaddress' => \@{$msg_hash->{macaddress}} ); my $wake_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data); # invoke trigger wake for this gosa-si-server &main::server_server_com::trigger_wake($msg, $msg_hash, $session_id); @@ -672,13 +668,13 @@ sub trigger_action_instant_update { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } - my %data = ( 'macAddress' => \@{$msg_hash->{macaddress}} ); + my %data = ( 'macaddress' => \@{$msg_hash->{macaddress}} ); my $wake_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data); # invoke trigger wake for this gosa-si-server &main::server_server_com::trigger_wake($msg, $msg_hash, $session_id); @@ -695,7 +691,7 @@ sub trigger_action_sysinfo { &main::change_fai_state('sysinfo', \@{$msg_hash->{macaddress}}, $session_id); my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -710,7 +706,7 @@ sub new_key_for_client { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -726,7 +722,7 @@ sub trigger_action_rescan { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } @@ -743,7 +739,7 @@ sub trigger_action_wake { my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0]; if( defined $jobdb_id) { - my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=jobdb_id"; + my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id"; &main::daemon_log("$session_id DEBUG: $sql_statement", 7); my $res = $main::job_db->exec_statement($sql_statement); } diff --git a/gosa-si/server/events/opsi_com.pm b/gosa-si/server/events/opsi_com.pm index e1fd6486f..c75b79f40 100644 --- a/gosa-si/server/events/opsi_com.pm +++ b/gosa-si/server/events/opsi_com.pm @@ -1234,7 +1234,7 @@ sub opsi_install_client { # Build wakeup message for client if (not $error) { my $wakeup_hash = &create_xml_hash("trigger_wake", "GOSA", "KNOWN_SERVER"); - &add_content2xml_hash($wakeup_hash, 'macAddress', $macaddress); + &add_content2xml_hash($wakeup_hash, 'macaddress', $macaddress); my $wakeup_msg = &create_xml_string($wakeup_hash); push(@out_msg_l, $wakeup_msg);