summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3ac7193)
raw | patch | inline | side by side (parent: 3ac7193)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 19 Aug 2008 15:43:44 +0000 (15:43 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 19 Aug 2008 15:43:44 +0000 (15:43 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12248 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/client/events/corefunctions.pm | patch | blob | history | |
gosa-si/modules/ClientPackages.pm | patch | blob | history | |
gosa-si/tests/client.php | patch | blob | history |
index 4f5bd3629eeaec1b771b3a1cb2b5c1e2272b3a94..f74f595d7e8782899737e108b5ff5d5b8ef043bf 100644 (file)
# @param msg_hash - HASHREF - message information parsed into a hash
sub new_ntp_config {
my ($msg, $msg_hash) = @_ ;
-
+
# Sanity check of incoming message
if ((not exists $msg_hash->{'server'}) || (not @{$msg_hash->{'server'}} >= 1) ) {
&main::daemon_log("ERROR: 'new_ntp_config'-message does not contain a ntp server: $msg", 1);
}
# Fetch the new ntp server from incoming message
- my @ntp_servers = $msg_hash->{'server'};
- my $ntp_servers_string = "server\t".join("\nserver\t", @ntp_servers)."\n";
+ my $ntp_servers = $msg_hash->{'server'};
+ &main::daemon_log("INFO: found ntp server: ".join(", ", @$ntp_servers), 5);
+ my $ntp_servers_string = "server\t".join("\nserver\t", @$ntp_servers)."\n";
my $found_server_flag = 0;
+ # Sanity check of /etc/chrony/chrony.conf
+ if (not -f $chrony_file) {
+ &main::daemon_log("ERROR: file '$chrony_file' does not exist, cannot do ntp reconfiguration!", 1);
+ return;
+ }
+
# Substitute existing server with new ntp server
- open (FILE, "+<$chrony_file");
+ open (FILE, "<$chrony_file");
my @file = <FILE>;
+ close FILE;
foreach my $line (@file) {
if ($line =~ /^server /) {
if ($found_server_flag) {
}
# Write changes to file and close it
+ open (FILE, "+>$chrony_file");
print FILE join("", @file);
close FILE;
&main::daemon_log("INFO: wrote new configuration file: $chrony_file", 5);
index d4ec76321c87bb9fb53b66929b8b38028194d559..270cda8ab5f41333eaf85f8ff3a017fa960802c6 100644 (file)
push(@out_msg_l, $new_ldap_config_out);
}
+ # Send client hardware configuration
my $hardware_config_out = &hardware_config($msg, $msg_hash, $session_id);
if( $hardware_config_out ) {
push(@out_msg_l, $hardware_config_out);
# Send client ntp server
-
+ my $ntp_config_out = &new_ntp_config($mac_address, $session_id);
+ if ($ntp_config_out) {
+ push(@out_msg_l, $ntp_config_out);
+ }
# notify registered client to all other server
my %mydata = ( 'client' => $source, 'macaddress' => $mac_address);
}
my $entry= $ldap_res->entry(0);
- my $dn= $entry->dn;
+ my $dn = &Net::LDAP::Util::escape_dn_value($entry->dn);
my @ntp_servers= $entry->get_value("gotoNtpServer");
# If no ntp server is specified at host, just have a look at the object group of the host
}
# Sanity check
- if ($mesg->count == 0) {
- &main::daemon_log("$session_id WARNING: no LDAP informations found for client with filter '(&(objectClass=gosaGroupOfNames)(member=$dn))'", 3);
- return;
- } elsif ($mesg->count >= 2) {
- &main::daemon_log("$session_id ERROR: multiple LDAP informations found for client with filter '(&(objectClass=gosaGroupOfNames)(member=$dn))'", 1);
+ if ($mesg->count != 1) {
+ &main::daemon_log("$session_id ERROR: client with mac address $macaddress not found/unique/active - not sending ldap config".
+ "\n\tbase: $ldap_base".
+ "\n\tscope: sub".
+ "\n\tattrs: dn, gotoLdapServer, FAIclass".
+ "\n\tfilter: (&(objectClass=gosaGroupOfNames)(member=$escaped_dn))", 1);
return;
}
# complain if no ldap information found
if (@servers == 0) {
- &main::daemon_log("$session_id ERROR: no gotoLdapServer information for LDAP entry with filter '(&(objectClass=gosaGroupOfNames)(member=$dn))'");
+ &main::daemon_log("$session_id ERROR: no gotoLdapServer information for LDAP entry '$dn'", 1);
}
foreach $server (@servers){
index 158da47acef74270cf4e494e3b37a43f05dca578..772cc39f682456b75c2e11681e5d57c5b52088a7 100755 (executable)
--- a/gosa-si/tests/client.php
+++ b/gosa-si/tests/client.php
##############################
# NTP reload
- #$data = "<xml> <header>gosa_trigger_reload_ntp_config</header> <source>GOSA</source> <target>GOSA</target> <macaddress>00:11:25:4B:8C:E5</macaddress> </xml>";
- $data = "<xml> <header>gosa_trigger_reload_ntp_config</header> <source>GOSA</source> <target>GOSA</target> <macaddress>00:01:6c:9d:b9:fa</macaddress> </xml>";
+ $data = "<xml> <header>gosa_trigger_reload_ntp_config</header> <source>GOSA</source> <target>GOSA</target> <macaddress>00:11:25:4B:8C:E5</macaddress> </xml>";
$sock->write($data);
$answer = "nothing";