diff --git a/trunk/gosa-si/client/events/corefunctions.pm b/trunk/gosa-si/client/events/corefunctions.pm
index 7e19a8b18dcdbd1f0e37d3e2f8dd2b0e94cddc56..e640c87a756f2d82e082519470f167ea95c4e7b0 100644 (file)
use GOSA::GosaSupportDaemon;
use File::Basename;
-my ($ldap_enabled, $offline_enabled, $ldap_config, $pam_config, $nss_config, $fai_logpath);
+my ($ldap_enabled, $offline_enabled, $ldap_config, $pam_config, $nss_config, $fai_logpath, $ldap_config_exit_hook);
my $chrony_file = "/etc/chrony/chrony.conf";
my $syslog_file = "/etc/syslog.conf";
"pam-config" => [\$pam_config, "/etc/pam_ldap.conf"],
"nss-config" => [\$nss_config, "/etc/libnss-ldap.conf"],
"fai-logpath" => [\$fai_logpath, "/var/log/fai/fai.log"],
+ "ldap-config-exit-hook" => [\$ldap_config_exit_hook, undef],
},
);
my $hostname= $main::client_dnsname;
$hostname =~ s/\..*$//;
$hostname =~ tr/A-Z/a-z/;
- open($opts_file_FH, ">$main::opts_file");
- print $opts_file_FH "MAC=\"$main::client_mac_address\"\n";
+ sysopen($opts_file_FH, $main::opts_file, O_RDWR | O_CREAT | O_TRUNC , 0644);
+ print $opts_file_FH "MAC=\"$main::client_mac_address\"\n";
print $opts_file_FH "IPADDRESS=\"$main::client_ip\"\n";
print $opts_file_FH "HOSTNAME=\"$hostname\"\n";
print $opts_file_FH "FQDN=\"$main::client_dnsname\"\n";
daemon_log("wrote $cfg_name", 5);
}
+ # Set permissions and ownership structure
+ chown(0, 0, $cfg_name);
+ chmod(0644, $cfg_name);
+
+ # Allow custom scripts to be executed
+ if (defined $ldap_config_exit_hook) {
+ system($ldap_config_exit_hook);
+ daemon_log("executed hook $ldap_config_exit_hook", 5);
+ }
+
return;
}