From f013f7edd0eeed6693cc2de1b3d124dd481eec65 Mon Sep 17 00:00:00 2001 From: rettenbe Date: Mon, 26 May 2008 08:21:32 +0000 Subject: [PATCH] * gosa-si-server-nobus * under construction git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10996 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-server-nobus | 2 +- gosa-si/server/events/server_server_com.pm | 60 +++++++++------------- 2 files changed, 26 insertions(+), 36 deletions(-) diff --git a/gosa-si/gosa-si-server-nobus b/gosa-si/gosa-si-server-nobus index db8d4447d..f8fbecf27 100755 --- a/gosa-si/gosa-si-server-nobus +++ b/gosa-si/gosa-si-server-nobus @@ -247,7 +247,7 @@ my $max_children = 2; "address" => [\$foreign_server_string, ""], "domain" => [\$server_domain, ""], "key" => [\$ServerPackages_key, "none"], - "key-lifetime" => [\$foreign_servers_register_delay, 600], + "key-lifetime" => [\$foreign_servers_register_delay, 120], } ); diff --git a/gosa-si/server/events/server_server_com.pm b/gosa-si/server/events/server_server_com.pm index 25cf2b66d..b2dc84776 100644 --- a/gosa-si/server/events/server_server_com.pm +++ b/gosa-si/server/events/server_server_com.pm @@ -53,6 +53,10 @@ sub new_server { &main::daemon_log("$session_id INFO: server_server_com.pm: server '$source' successfully added to known_server_db", 5); } + # delete all entries at foreign_clients_db coresponding to this server + my $sql = "DELETE FROM $main::foreign_clients_tn WHERE regserver='$source' "; + my $res = $main::foreign_clients_db->exec_statement($sql); + # add clients of foreign server to known_foreign_clients_db my @sql_list; foreach my $client (@clients) { @@ -99,41 +103,27 @@ sub confirm_new_server { sub new_foreign_client { - my ($msg, $msg_hash, $session_id) = @_ ; - my $header = @{$msg_hash->{'header'}}[0]; - my $source = @{$msg_hash->{'source'}}[0]; - my $hostname = @{$msg_hash->{'client'}}[0]; - my $macaddress = @{$msg_hash->{'macaddress'}}[0]; - - my $func_dic = { table => $main::foreign_clients_tn, - primkey => ['hostname'], - hostname => $hostname, - macaddress => $macaddress, - regserver => $source, - timestamp => &get_time(), - }; - - - my $res = $main::foreign_clients_db->add_dbentry($func_dic); - if (not $res == 0) { - &main::daemon_log("$session_id ERROR: server_server_com.pm: cannot add server to foreign_clients_db: $res", 1); - } else { - &main::daemon_log("$session_id INFO: server_server_com.pm: client '$hostname' successfully added to foreign_clients_db", 5); - } - - -# -# my $func_dic = {table=>$main::known_server_tn, -# primkey=>['hostname'], -# hostname => $source, -# hostkey => $key, -# timestamp=>&get_time(), -# }; -# my $res = $main::known_server_db->add_dbentry($func_dic); -# - - - return; + my ($msg, $msg_hash, $session_id) = @_ ; + my $header = @{$msg_hash->{'header'}}[0]; + my $source = @{$msg_hash->{'source'}}[0]; + my $hostname = @{$msg_hash->{'client'}}[0]; + my $macaddress = @{$msg_hash->{'macaddress'}}[0]; + + my $func_dic = { table => $main::foreign_clients_tn, + primkey => ['hostname'], + hostname => $hostname, + macaddress => $macaddress, + regserver => $source, + timestamp => &get_time(), + }; + my $res = $main::foreign_clients_db->add_dbentry($func_dic); + if (not $res == 0) { + &main::daemon_log("$session_id ERROR: server_server_com.pm: cannot add server to foreign_clients_db: $res", 1); + } else { + &main::daemon_log("$session_id INFO: server_server_com.pm: client '$hostname' successfully added to foreign_clients_db", 5); + } + + return; } -- 2.30.2