Code

* gosa-si-server-nobus
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 May 2008 08:21:32 +0000 (08:21 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 May 2008 08:21:32 +0000 (08:21 +0000)
* under construction

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10996 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server-nobus
gosa-si/server/events/server_server_com.pm

index db8d4447db3d21b4874a9d95c1859a477445b889..f8fbecf277effc1f17a8de90cc2f61c2db25c873 100755 (executable)
@@ -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],
 }
 );
 
index 25cf2b66d92df75b6bf7929905de23d78c141bdd..b2dc8477662599f6ea27b8a23eb446a19f000fd1 100644 (file)
@@ -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;
 }