From: rettenbe Date: Tue, 27 Oct 2009 15:02:13 +0000 (+0000) Subject: * add a function to set the REGISTRATION flag X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2a3fac051145077f2f7377bf2dffd04431ae0197;p=gosa.git * add a function to set the REGISTRATION flag * add microseconds to daemon log timestamp git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14661 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/client/events/corefunctions.pm b/gosa-si/client/events/corefunctions.pm index 8c599849f..1b387e5fe 100644 --- a/gosa-si/client/events/corefunctions.pm +++ b/gosa-si/client/events/corefunctions.pm @@ -106,7 +106,7 @@ sub registered { $main::client_address = $target; # set registration_flag to true - $main::REGISTERED = 1; + &main::_setREGISTERED(1); # Write the MAC address to file if(stat($main::opts_file)) { @@ -452,7 +452,6 @@ sub new_ldap_config { sub new_key { - # Create new key my $new_server_key = &main::create_passwd(); diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client index e8d37fe34..613aedb11 100755 --- a/gosa-si/gosa-si-client +++ b/gosa-si/gosa-si-client @@ -74,7 +74,7 @@ our $server_key; our $terminal_server_hash; # default variables -our $REGISTERED = 0; +my $REGISTERED = 0; # path to fifo for non-gosa-si-client messages to gosa-si-server my $fai_com_fifo = "/var/run/gosa-si-client.socket"; @@ -260,7 +260,12 @@ sub daemon_log { $monthday = $monthday < 10 ? $monthday = "0".$monthday : $monthday; $year+=1900; - my $log_msg = "$month $monthday $hours:$minutes:$seconds $prg $msg\n"; + # Microseconds since epoch + my $microSeconds = sprintf("%.2f", &Time::HiRes::clock_gettime()); + $microSeconds =~ s/^\d*(.\d\d)$/$1/; + + + my $log_msg = "$month $monthday $hours:$minutes:$seconds$microSeconds $prg $msg\n"; print LOG_HANDLE $log_msg; if( $foreground ) { print STDERR $log_msg; @@ -445,6 +450,12 @@ sub send_msg_hash_to_target { return $error; } +sub _setREGISTERED { + my $newStatus = shift; + &daemon_log("DEBUG: set REGISTERED flag from '$REGISTERED' to '$newStatus'", 7); + $REGISTERED = $newStatus; + return; +} sub send_msg_to_target { my ($msg, $address, $encrypt_key, $msg_header) = @_ ; @@ -465,7 +476,7 @@ sub send_msg_to_target { if( !$socket ) { daemon_log("WARNING: cannot send ".$msg_header."msg to '$address', host not reachable", 3); if ($REGISTERED == 1) { - $REGISTERED = 0; # if server is not available, cause reregistering + &_setREGISTERED(0); # if server is not available, cause reregistering daemon_log("INFO: cause reregistering at gosa-si-server", 5); $global_kernel->yield('register_at_gosa_si_server'); @@ -1069,10 +1080,14 @@ sub server_input { if($server_address =~ /$remote_ip/) { # Got a msg from gosa-si-server which can not be decrypted, the secrete is not up-to-date # cause a reregistering with a new secrete handshake - daemon_log("ERROR: Message from gosa-si-server could not be understood, cause reregistering at server", 1); - daemon_log("INFO: Set status of si-client to unregistered and throw new registering event", 5); - $REGISTERED = 0; - $kernel->post('client_session', 'register_at_gosa_si_server'); + daemon_log("ERROR: Message from gosa-si-server could not be understood, cause reregistering at server", 1); + if ($REGISTERED) { + daemon_log("INFO: Client has currently status registered so throw new registering event", 5); + &_setREGISTERED(0); + $kernel->post('client_session', 'register_at_gosa_si_server'); + } else { + daemon_log("INFO: Client is currently within a registration process so wait for the next registration itteration", 5); + } } $error++; } diff --git a/gosa-si/tests/client.php b/gosa-si/tests/client.php index c9907e3b7..c9fde5ffd 100755 --- a/gosa-si/tests/client.php +++ b/gosa-si/tests/client.php @@ -49,7 +49,7 @@ for($count = 1; $count <= $zahl; $count++) #$data = "
gosa_opsi_getSoftwareLicenseUsages
GOSA00:01:6C:9D:B9:FAkrakenarme.intranet.gonicus.de
"; #$data = "
gosa_opsi_getSoftwareLicenseUsages
GOSA00:01:6C:9D:B9:FALicensePool
"; #$data = "
gosa_opsi_getSoftwareLicenseUsages
GOSA00:01:6C:9D:B9:FA
"; - $data = "
gosa_opsi_getSoftwareLicenseUsagesForProductId
GOSA00:01:6C:9D:B9:FAfirefox
"; + #$data = "
gosa_opsi_getSoftwareLicenseUsagesForProductId
GOSA00:01:6C:9D:B9:FAfirefox
"; #$data = "
gosa_opsi_getSoftwareLicense_hash
GOSA00:01:6C:9D:B9:FAl_2009-09-22_09:50:58_0
"; @@ -114,7 +114,7 @@ for($count = 1; $count <= $zahl; $count++) # trigger jobs at client #$data = "
gosa_trigger_goto_settings_reload
00:01:6c:9d:b9:fa GOSA
"; #$data = "
gosa_detect_hardware
00:0C:29:4C:4B:0C GOSA
"; - #$data = "
gosa_new_key_for_client
00:0C:29:4C:4B:0C GOSA
"; + $data = "
gosa_new_key_for_client
$mac GOSA $mac
"; #$data = "
gosa_trigger_action_wake
00:0C:29:4C:4B:0C GOSA
"; #$data = "
gosa_trigger_action_faireboot
00:0C:29:4C:4B:0C GOSA
"; #$data = "
gosa_trigger_action_reboot
00:0C:29:4C:4B:0C GOSA
";