summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 45150cb)
raw | patch | inline | side by side (parent: 45150cb)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 26 May 2008 13:33:46 +0000 (13:33 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 26 May 2008 13:33:46 +0000 (13:33 +0000) |
* under construction
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11005 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11005 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-client | patch | blob | history | |
gosa-si/gosa-si-server-nobus | patch | blob | history | |
gosa-si/modules/ClientPackages.pm | patch | blob | history |
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index 17dcdff3e906dd5b22aefd28eeb94f0bfd8dd302..05632d3167ead89f416e6eca35a599e2dc314f0f 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
&add_content2xml_hash($register_hash, "client_status", $client_status);
&add_content2xml_hash($register_hash, "client_revision", $client_revision);
&add_content2xml_hash($register_hash, "gotoHardwareChecksum", $gotoHardwareChecksum);
+ &add_content2xml_hash($register_hash, "key_lifetime", $server_key_lifetime);
# Add $HOSTNAME from ENV if force-hostname is set
if( defined($client_force_hostname) && $client_force_hostname eq "true") {
index f8fbecf277effc1f17a8de90cc2f61c2db25c873..ffae53c602bf69b08341eb18edb2e0544a621e15 100755 (executable)
our $known_clients_db;
our $known_clients_tn = "known_clients";
my $known_clients_file_name;
-my @known_clients_col_names = ("hostname", "status", "hostkey", "timestamp", "macaddress", "events");
+my @known_clients_col_names = ("hostname", "status", "hostkey", "timestamp", "macaddress", "events", "keylifetime");
# holds all registered clients at a foreign server
our $foreign_clients_db;
$kernel->delay_set('watch_for_new_messages', $messaging_db_loop_delay);
$kernel->delay_set('watch_for_delivery_messages', $messaging_db_loop_delay);
$kernel->delay_set('watch_for_done_messages', $messaging_db_loop_delay);
+ $kernel->delay_set('watch_for_old_known_clients', $job_queue_loop_delay);
}
# fetch key to encrypt msg propperly for usr/host
my $sql = "SELECT * FROM $known_clients_tn WHERE (hostname='$receiver_host')";
&daemon_log("0 DEBUG: $sql", 7);
- my $res = $known_clients_db->exec_statement($sql);
+ my $res = $known_clients_db->select_dbentry($sql);
# host is already down
if (not ref(@$res[0]) eq "ARRAY") { next; }
}
+sub watch_for_old_known_clients {
+ my ($kernel,$heap) = @_[KERNEL, HEAP];
+
+ my $sql_statement = "SELECT * FROM $known_clients_tn";
+ my $res = $known_clients_db->select_dbentry( $sql_statement );
+
+ my $act_time = int(&get_time());
+ while ( my ($hit_num, $hit) = each %$res) {
+ my $expired_timestamp = int($hit->{'timestamp'}) + (2 * int($hit->{'keylifetime'}));
+ if ($act_time > $expired_timestamp) {
+ my $hostname = $hit->{'hostname'};
+ my $del_sql = "DELETE FROM $known_clients_tn WHERE hostname='$hostname'";
+ my $del_res = $known_clients_db->exec_statement($del_sql);
+
+ &main::daemon_log("0 INFO: timestamp of client '$hostname' is expired, client will be deleted from known_clients_db", 5);
+ }
+
+ }
+
+ $kernel->delay_set('watch_for_old_known_clients', $job_queue_loop_delay);
+}
+
+
sub get_ldap_handle {
my ($session_id) = @_;
my $heap;
if ($session_id == 0) {
daemon_log("$session_id DEBUG: get_ldap_handle invoked without a session_id, create a new ldap_handle", 7);
$ldap_handle = Net::LDAP->new( $ldap_uri );
- $ldap_handle->bind($ldap_admin_dn, password => $ldap_admin_password);
+ $ldap_handle->bind($ldap_admin_dn, apassword => $ldap_admin_password);
} else {
my $session_reference = $global_kernel->ID_id_to_session($session_id);
watch_for_done_messages => \&watch_for_done_messages,
watch_for_new_jobs => \&watch_for_new_jobs,
watch_for_done_jobs => \&watch_for_done_jobs,
+ watch_for_old_known_clients => \&watch_for_old_known_clients,
create_packages_list_db => \&run_create_packages_list_db,
create_fai_server_db => \&run_create_fai_server_db,
create_fai_release_db => \&run_create_fai_release_db,
index 0656f8ba55928b51fe9d7f5f21f38ba9394046a9..52a2515cad4c9229355277f353f3d70d3dcb40f1 100644 (file)
my $gotoHardwareChecksum = @{$msg_hash->{gotoHardwareChecksum}}[0];
my $client_status = @{$msg_hash->{client_status}}[0];
my $client_revision = @{$msg_hash->{client_revision}}[0];
+ my $key_lifetime = @{$msg_hash->{key_lifetime}}[0];
# number of known clients
my $nu_clients= $main::known_clients_db->count_dbentries('known_clients');
status=>'registered',
hostkey=>$new_passwd,
timestamp=>$act_timestamp,
+ keylifetime=>$key_lifetime,
} );
if ($res != 0) {