index 016e6b888ee0d91d2c9b5db40be6d84c885fdbb8..a25aa98cb89f3ed1fbffa3cf949979c768ab1ad1 100644 (file)
my @events = (
"get_events",
"registered",
- 'new_syslog_config',
+ "new_syslog_config",
"new_ntp_config",
"new_ldap_config",
"new_key",
chomp($string);
if( not -f $file ) {
- open (FILE, "$file");
- close(FILE);
+ open (my $FD_FILE, "$file");
+ close($FD_FILE);
}
- open(FILE, ">>", "$file") or &main::daemon_log("ERROR in corefunctions.pm: can not open '$file' to write '$string'", 1);;
- print FILE $string."\n";
- close(FILE);
+ open(my $FD_FILE, ">>", "$file") or &main::daemon_log("ERROR in corefunctions.pm: can not open '$file' to write '$string'", 1);;
+ print $FD_FILE $string."\n";
+ close($FD_FILE);
}
return;
}
# Substitute existing server with new syslog server
- open ($FILE, "<","$syslog_file");
+ open (my $FILE, "<","$syslog_file");
my @file = <$FILE>;
close($FILE);
my $syslog_server_line = "*.*\t@".$syslog_server."\n";
}
# Write changes to file and close it
- open ($FILE, "+>","$syslog_file");
+ open (my $FILE, "+>","$syslog_file");
print $FILE join("", @file);
close($FILE);
&main::daemon_log("INFO: Wrote new configuration file: $syslog_file", 5);
}
# Substitute existing server with new ntp server
- open ($FILE, "<","$chrony_file");
+ open (my $FILE, "<","$chrony_file");
my @file = <$FILE>;
close($FILE);
my @new_file;
}
# Write changes to file and close it
- open ($FILE, ">","$chrony_file");
+ open (my $FILE, ">","$chrony_file");
print $FILE join("", @new_file);
close($FILE);
&main::daemon_log("INFO: Wrote new configuration file: $chrony_file", 5);
# Setup ldap.conf
my $file1;
my $file2;
- open($file1, ">","$ldap_config");
+ open(my $file1, ">","$ldap_config");
print $file1 "# This file was automatically generated by gosa-si-client. Do not change.\n";
print $file1 "URI";
foreach $element (@ldap_uris) {
daemon_log("INFO: Wrote $ldap_config", 5);
# Setup pam_ldap.conf / libnss-ldap.conf
- open($file1, ">","$pam_config");
- open($file2, ">","$nss_config");
+ open(my $file1, ">","$pam_config");
+ open(my $file2, ">","$nss_config");
print $file1 "# This file was automatically generated by gosa-si-client. Do not change.\n";
print $file2 "# This file was automatically generated by gosa-si-client. Do not change.\n";
print $file1 "uri";
# Create goto.secrets if told so - for compatibility reasons
if (defined $goto_admin){
- open($file1, ">","/etc/goto/secret");
+ open(my $file1, ">","/etc/goto/secret");
close($file1);
chown(0,0, "/etc/goto/secret");
chmod(0600, "/etc/goto/secret");
- open($file1, ">","/etc/goto/secret");
+ open(my $file1, ">","/etc/goto/secret");
print $file1 "GOTOADMIN=\"$goto_admin\"\nGOTOSECRET=\"$goto_secret\"\n";
close($file1);
daemon_log("INFO: Wrote /etc/goto/secret", 5);
my $ldap_server= $ldap_uris[0];
$ldap_server=~ s/^ldap:\/\/([^:]+).*$/$1/;
- open($file1, ">","$cfg_name");
+ open(my $file1, ">","$cfg_name");
print $file1 "LDAP_BASE=\"$ldap_base\"\n";
print $file1 "LDAP_SERVER=\"$ldap_server\"\n";
print $file1 "LDAP_URIS=\"@ldap_uris\"\n";
$cfg_name= "/etc/ldap/ldap-offline.conf";
# Get first LDAP server
- open($file1, ">","$cfg_name");
+ open(my $file1, ">","$cfg_name");
print $file1 "LDAP_BASE=\"$ldap_base\"\n";
print $file1 "LDAP_SERVER=\"127.0.0.1\"\n";
print $file1 "LDAP_URIS=\"ldap://127.0.0.1\"\n";