diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index 2e5a36166d8423204bb0bca7f40762efe720cdd1..a3987e70ea920ee83c64028be8bc654ee7441741 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
if(not defined $level) { $level = 1 }
if(defined $log_file){
open(LOG_HANDLE, ">>$log_file");
- chmod 0600, $log_file;
if(not defined open( LOG_HANDLE, ">>$log_file" )) {
print STDERR "cannot open $log_file: $!";
return
# Check if our ip is resolvable - if not: don't try to register
my $ip= &get_local_ip_for_remote_ip(sprintf("%s", $server =~ /^([0-9\.]*?):.*$/));
my $dnsname= gethostbyaddr(inet_aton($ip), AF_INET);
- if(!defined($dnsname)) {
- if( defined($client_force_hostname) && $client_force_hostname eq "true") {
- $dnsname = `hostname`;
- } else {
- &write_to_file("goto-error-dns:$ip", $fai_logpath);
- exit(1);
- }
- }
+ if(!defined($dnsname)) {
+ if( defined($client_force_hostname) && $client_force_hostname eq "true") {
+ $dnsname = `hostname`;
+ } else {
+ &write_to_file("goto-error-dns:$ip", $fai_logpath);
+ &main::daemon_log("ERROR: ip is not resolvable, no registration possible. Write 'goto-error-dns:$ip' to $fai_logpath", 1);
+ exit(1);
+ }
+ }
# create registration msg
my $local_ip = &get_local_ip_for_remote_ip(sprintf("%s", $server =~ /^([0-9\.]*?):.*$/));
my $clmsg_hash = &create_xml_hash("CLMSG_$header", $client_address, $server_address, $content);
&add_content2xml_hash($clmsg_hash, "macaddress", $client_mac_address);
+ my $utc_ts = &main::get_utc_time();
+ &add_content2xml_hash($clmsg_hash, "timestamp", $utc_ts);
my $clmsg = &create_xml_string($clmsg_hash);
&send_msg_to_target($clmsg, $server_address, $server_key, "CLMSG_$header");
$client_status = "developmental" ;
}
+# Prepare log file
+my $root_uid = getpwnam('root');
+my $adm_gid = getgrnam('adm');
+chmod(0640, $log_file);
+chown($root_uid, $adm_gid, $log_file);
+
+
daemon_log(" ", 1);
daemon_log("$prg started!", 1);
daemon_log("INFO: status: $client_status", 1);