summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6a9f0a5)
raw | patch | inline | side by side (parent: 6a9f0a5)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 7 Jan 2008 14:02:48 +0000 (14:02 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 7 Jan 2008 14:02:48 +0000 (14:02 +0000) |
modified: ServerPackages: new_ldap_config
modified: GosaSupportDaemon: send_msg
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8236 594d385d-05f5-0310-b6e9-bd551577e9d8
modified: GosaSupportDaemon: send_msg
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8236 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-server | patch | blob | history | |
gosa-si/modules/GosaSupportDaemon.pm | patch | blob | history | |
gosa-si/modules/ServerPackages.pm | patch | blob | history |
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index c60c5e2887cc82197ff00627dc2971fa924381b7..24295fba0798bae5eb3474e77a8012f9c7eff25a 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
our $job_db;
# holds all other gosa-sd as well as the gosa-sd-bus
-our $known_server;
+our $known_server_db;
our $known_daemons = {};
our $shmda = tie($known_daemons, 'IPC::Shareable', undef, {create => 1,
exclusive => 1,
destroy => 1,
});
# holds all registrated clients
-our $known_clients;
+our $known_clients_db;
#our $known_clients = {};
#our $shmcl = tie($known_clients, 'IPC::Shareable', undef, {create => 1,
# exclusive => 1,
#my $res = $job_db->select_dbentry( { table=>$job_queue_table_name, status=>'waiting', timestamp=>'$timestamp'} );
my $res = $job_db->select_dbentry( { table=>$job_queue_table_name, status=>'waiting', timestamp=>'2007010709014800'} );
+
while( my ($id, $hit) = each %{$res} ) {
my $jobdb_id = $hit->{ROWID};
index 670bb8e27a391268d29804b9dfe97f78f6dacf90..46f3d09040902d77fc41a7c79e8b01f2839f6a31 100644 (file)
# package
# RETURNS: nothing
#===============================================================================
-sub send_msg ($$$$) {
- my ($header, $from, $to, $data) = @_;
+sub send_msg ($$$$$) {
+ my ($header, $from, $to, $data, $hostkey) = @_;
my $out_hash = &create_xml_hash($header, $from, $to);
}
}
- &send_msg_hash2address($out_hash, $to);
+ &send_msg_hash2address($out_hash, $to, $hostkey);
}
1;
index e810ffb0e47aeda5026bcb918cf0b08a39adb095..7797dc404d0d23d05ded81969dc896aab4534448 100644 (file)
}
# connect to known_clients_db
-my $known_clients_db = GOSA::DBsqlite->new($known_clients_file_name);
+#my $known_clients_db = GOSA::DBsqlite->new($known_clients_file_name);
# register at bus
my $out_hash;
# number of known clients
- my $nu_clients = keys %{$known_clients_db->select_dbentry( {table=>'known_clients'} )};
+ my $nu_clients = keys %{$main::known_clients_db->select_dbentry( {table=>'known_clients'} )};
# check wether client address or mac address is already known
if (exists $main::known_clients->{$source}) {
my $events = @{$msg_hash->{events}}[0];
# add entry to known_clients_db
- my $res = $known_clients_db->add_dbentry( {table=>'known_clients',
+ my $res = $main::known_clients_db->add_dbentry( {table=>'known_clients',
primkey=>'hostname',
hostname=>$source,
events=>$events,
timestamp=>&get_time,
} );
if ($res == 3) {
- $res = $known_clients_db->update_dbentry( {table=>'known_clients',
+ $res = $main::known_clients_db->update_dbentry( {table=>'known_clients',
where=>'hostname',
hostname=>$source,
events=>$events,
sub new_ldap_config {
my ($address) = @_ ;
- if (not exists $main::known_clients->{$address}) {
- &main::daemon_log("ERROR: $address does not exist in known_clients, cannot send him his ldap config", 1);
- return;
+ my $res = $main::known_clients_db->select_dbentry( { table=>'known_clients', hostname=>$address } );
+
+ # check hit
+ my $hit_counter = keys %{$res};
+ if( not $hit_counter == 1 ) {
+ &main::daemon_log("ERROR: more or no hit found in known_clients_db by query by '$address'", 1);
+ my $tmp = print Dumer $res;
}
-
- my $mac_address = $main::known_clients->{$address}->{"mac_address"};
- if (not defined $mac_address) {
+
+ my $macaddress = $res->{1}->{macaddress};
+ my $hostkey = $res->{1}->{hostkey};
+
+ if (not defined $macaddress) {
&main::daemon_log("ERROR: no mac address found for client $address", 1);
return;
}
$mesg = $ldap->search( base => $ldap_base,
scope => 'sub',
attrs => ['dn', 'gotoLdapServer'],
- filter => "(&(objectClass=GOhard)(macaddress=$mac_address))");
+ filter => "(&(objectClass=GOhard)(macaddress=$macaddress))");
$mesg->code && die $mesg->error;
# Sanity check
if ($mesg->count != 1) {
- &main::daemon_log("WARNING: client mac address $mac_address not found/not unique", 1);
+ &main::daemon_log("WARNING: client mac address $macaddress not found/not unique", 1);
return;
}
# Sanity check
if ($mesg->count != 1) {
- &main::daemon_log("WARNING: no LDAP information found for client mac $mac_address", 1);
+ &main::daemon_log("WARNING: no LDAP information found for client mac $macaddress", 1);
return;
}
}
# Send information
- send_msg("new_ldap_config", $server_address, $address, \%data);
+ send_msg("new_ldap_config", $server_address, $address, \%data, $hostkey);
return;
}