From 895d8d89acaf1c8afe6ee957fbb79f1ecece0699 Mon Sep 17 00:00:00 2001 From: psc Date: Fri, 15 Apr 2011 14:16:32 +0000 Subject: [PATCH] Followup patch for #6578 Set $server_ip to public IP if gosa-si-client registers with the server on the same host. Fix an off-by-one error when detecting whether registering with all servers has been tried. Do not discard messages from 127.0.0.1 git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@20738 594d385d-05f5-0310-b6e9-bd551577e9d8 --- trunk/gosa-si/gosa-si-client | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/trunk/gosa-si/gosa-si-client b/trunk/gosa-si/gosa-si-client index 6d7c808b5..fa7aecce8 100755 --- a/trunk/gosa-si/gosa-si-client +++ b/trunk/gosa-si/gosa-si-client @@ -651,13 +651,13 @@ sub register_at_gosa_si_server { last; # delivery of registration msg failed - } elsif($REGISTRATION_TRIES >= scalar(@servers)) { + } elsif($REGISTRATION_TRIES > scalar(@servers)) { last; } } # end of while # one circle through all servers finished and no registration succeed - if ( $REGISTRATION_TRIES >= (scalar(@servers)) ) { + if ( $REGISTRATION_TRIES > (scalar(@servers)) ) { $REGISTRATION_TRIES = 0; &write_to_file("gosa-si-no-server-available", $fai_logpath); daemon_log("WARNING: Could not register with any of the servers, waiting $delay_set_time seconds",3); @@ -1056,11 +1056,11 @@ sub server_input { my $msg_hash; - daemon_log("INFO: Incoming msg from '$remote_ip'", 5); + daemon_log("INFO: Incoming msg from '$remote_ip', server_ip: $server_ip", 5); daemon_log("DEBUG: Incoming msg:\n$input\n", 9); - if (not "$remote_ip" eq "$server_ip") { - daemon_log("INFO: Incoming msg not from server, ignoring", 5); + if (not "$remote_ip" eq "$server_ip" and "$server_ip" ne "127.0.0.1") { + daemon_log("INFO: Incoming msg not from server ($server_ip), ignoring", 5); $error++; } else { ($msg, $msg_hash) = &check_key_and_xml_validity($input, $server_key); @@ -1129,6 +1129,10 @@ sub server_input { # set registered flag to true to stop sending further registered msgs $REGISTERED = 1; $REGISTRATION_IN_PROGRESS = 0; + if( $server_ip eq "127.0.0.1") { + $server_ip = $remote_ip; + daemon_log("INFO: Registered at localhost, setting server_ip to $server_ip",3); + } } else { $answer =~ /
(\S+)<\/header>/; -- 2.30.2