From: rettenbe Date: Tue, 20 May 2008 07:01:18 +0000 (+0000) Subject: * gosa-si-server-nobus X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c4a451b0f468e197e5dbcb4816dbd1b7767faaa9;p=gosa.git * gosa-si-server-nobus * under construction git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10961 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/server/events/server_server_com.pm b/gosa-si/server/events/server_server_com.pm index 2df9c7c2e..2b130d8f7 100644 --- a/gosa-si/server/events/server_server_com.pm +++ b/gosa-si/server/events/server_server_com.pm @@ -24,7 +24,41 @@ sub get_events { sub new_server { -print STDERR "hier kommt die logik von new_server\n"; + my ($msg, $msg_hash, $session_id) = @_ ; + my $header = @{$msg_hash->{'header'}}[0]; + my $source = @{$msg_hash->{'source'}}[0]; + my $target = @{$msg_hash->{'target'}}[0]; + my $key = @{$msg_hash->{'key'}}[0]; + my $clients = @{$msg_hash->{'clients'}}[0]; + + # sanity check + if (ref $key eq 'HASH') { + &main::daemon_log("$session_id ERROR: 'new_server'-message from host '$source' contains no key!", 1); + #return; + } + + # add foreign server to known_server_db + 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); + if (not $res == 0) { + &main::daemon_log("$session_id ERROR: server_server_com.pm: cannot add server to known_server_db: $res", 1); + } else { + &main::daemon_log("$session_id INFO: server_server_com.pm: server '$source' successfully added to known_server_db", 5); + } + + # add clients of foreign server to known_foreign_clients_db + + + # build confirm_new_server message + my $out_msg = &build_msg('confirm_new_server', $main::server_address, $source); + my $error = &main::send_msg_to_target($out_msg, $source, $key, 'confirm_new_server', 0); + + } 1;