diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 6815ecbc3689562f2032fc6ecd7588751f1c7afc..29542324b1d5628adf6d59b2808c51224e534ca5 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
# REVISION: ---
#===============================================================================
-
-# TODO
-#
-# max_children wird momentan nicht mehr verwendet, jede eingehende nachricht bekommt ein eigenes POE child
+my $server_version = '$HeadURL: https://oss.gonicus.de/repositories/gosa/trunk/gosa-si/gosa-si-server $:$Rev$';
use strict;
use warnings;
use Net::LDAP::Util qw(:escape);
use Time::HiRes qw( usleep);
+# revision number of server and program name
+my $server_headURL;
+my $server_revision;
+my $server_status;
+our $prg= basename($0);
+
my $db_module = "DBsqlite";
{
no strict "refs";
my $modules_path = "/usr/lib/gosa-si/modules";
use lib "/usr/lib/gosa-si/modules";
-# revision number of server and program name
-my $server_version = '$HeadURL: https://oss.gonicus.de/repositories/gosa/trunk/gosa-si/gosa-si-server $:$Rev: 10826 $';
-my $server_headURL;
-my $server_revision;
-my $server_status;
-our $prg= basename($0);
-
our $global_kernel;
my ($foreground, $ping_timeout);
my ($server);
}
-#sub get_local_ip_for_remote_ip {
-# my $remote_ip= shift;
-# my $result="0.0.0.0";
-#
-# if($remote_ip =~ /^(\d\d?\d?\.){3}\d\d?\d?$/) {
-# if($remote_ip eq "127.0.0.1") {
-# $result = "127.0.0.1";
-# } else {
-# my $PROC_NET_ROUTE= ('/proc/net/route');
-#
-# open(PROC_NET_ROUTE, "<$PROC_NET_ROUTE")
-# or die "Could not open $PROC_NET_ROUTE";
-#
-# my @ifs = <PROC_NET_ROUTE>;
-#
-# close(PROC_NET_ROUTE);
-#
-# # Eat header line
-# shift @ifs;
-# chomp @ifs;
-# foreach my $line(@ifs) {
-# my ($Iface,$Destination,$Gateway,$Flags,$RefCnt,$Use,$Metric,$Mask,$MTU,$Window,$IRTT)=split(/\s/, $line);
-# my $destination;
-# my $mask;
-# my ($d,$c,$b,$a)=unpack('a2 a2 a2 a2', $Destination);
-# $destination= sprintf("%d.%d.%d.%d", hex($a), hex($b), hex($c), hex($d));
-# ($d,$c,$b,$a)=unpack('a2 a2 a2 a2', $Mask);
-# $mask= sprintf("%d.%d.%d.%d", hex($a), hex($b), hex($c), hex($d));
-# if(new NetAddr::IP($remote_ip)->within(new NetAddr::IP($destination, $mask))) {
-# # destination matches route, save mac and exit
-# $result= &get_ip($Iface);
-# last;
-# }
-# }
-# }
-# } else {
-# daemon_log("0 WARNING: get_local_ip_for_remote_ip() was called with a non-ip parameter: '$remote_ip'", 1);
-# }
-# return $result;
-#}
-
-
sub send_msg_to_target {
my ($msg, $address, $encrypt_key, $msg_header, $session_id) = @_ ;
my $error = 0;
&daemon_log("$session_id DEBUG: $sql_statement", 7);
my $res = $job_db->update_dbentry($sql_statement);
} else {
- &daemon_log("$session_id WARNING: sending message succeed but cannot update job status.", 3);
+ &daemon_log("$session_id DEBUG: sending message succeed but cannot update job status.", 7);
}
}
} else {
- &daemon_log("$session_id ERROR: cannot update job status, msg has no jobdb_id-tag: $answer", 1);
+ &daemon_log("$session_id DEBUG: cannot update job status, msg has no jobdb_id-tag: $answer", 7);
}
}
my ($msg, $msg_hash, $module);
my $error = 0;
- # hole neue msg aus @msgs_to_decrypt
- my $next_msg = shift @msgs_to_decrypt;
+ # fetch new msg out of @msgs_to_decrypt
+ my $tmp_next_msg = shift @msgs_to_decrypt;
+ my ($next_msg, $msg_source) = split(/;/, $tmp_next_msg);
# msg is from a new client or gosa
($msg, $msg_hash, $module) = &input_from_unknown_host($next_msg, $session_id);
if(( !$msg ) || ( !$msg_hash ) || ( !$module )){
# if an incoming msg could not be decrypted (maybe a wrong key), send client a ping. If the client
# could not understand a msg from its server the client cause a re-registering process
+ my $remote_ip = $heap->{'remote_ip'};
+ my $remote_port = $heap->{'remote_port'};
+ my $ping_msg = "<xml> <header>gosa_ping</header> <source>$server_address</source><target>$msg_source</target></xml>";
+ my ($test_error, $test_error_string) = &send_msg_to_target($ping_msg, "$msg_source", "dummy-key", "gosa_ping", $session_id);
+
daemon_log("$session_id WARNING cannot understand incoming msg, send 'ping'-msg to all host with ip '".$heap->{remote_ip}.
"' to cause a re-registering of the client if necessary", 3);
- my $sql_statement = "SELECT * FROM $main::known_clients_tn WHERE (hostname LIKE '".$heap->{'remote_ip'}."%')";
- my $query_res = $known_clients_db->select_dbentry( $sql_statement );
- while( my ($hit_num, $hit) = each %{ $query_res } ) {
- my $host_name = $hit->{'hostname'};
- my $host_key = $hit->{'hostkey'};
- my $ping_msg = "<xml> <header>gosa_ping</header> <source>$server_address</source> <target>$host_name</target></xml>";
- my $error = &send_msg_to_target($ping_msg, $host_name, $host_key, "gosa_ping", $session_id);
- &update_jobdb_status_for_send_msgs($ping_msg, $error);
- }
$error++;
}