Changed xml agent filename to hash to avoid special chars problems

This commit is contained in:
Calvo 2023-04-25 09:52:22 +02:00
parent db2b2b796b
commit 3fabf795a5
2 changed files with 2 additions and 2 deletions

View File

@ -2018,7 +2018,7 @@ sub pandora_agent_run () {
$Xml = $xml_header . $Xml . "</agent_data>";
# Save XML data file
my $temp_file = $Conf{'temporal'} . '/' . $Conf{'agent_name'} . '.' . time () . '.data';
my $temp_file = $Conf{'temporal'} . '/' . md5($Conf{'agent_name'}) . '.' . time () . '.data';
if (-l $temp_file && !unlink($temp_file)) {
error ("File '$temp_file' already exists as a symlink and could not be removed: $!");
return 1;

View File

@ -4377,7 +4377,7 @@ while (1) {
$Xml = $xml_header . $Xml . "</agent_data>";
# Save XML data file
my $temp_file = $Conf{'temporal'} . '/' . $Conf{'agent_name'} . '.' . time () . '.data';
my $temp_file = $Conf{'temporal'} . '/' . md5($Conf{'agent_name'}) . '.' . time () . '.data';
error ("File '$temp_file' already exists as a symlink and could not be removed: $!") if (-l $temp_file && !unlink($temp_file));
open (TEMP_FILE, "> $temp_file") || error ("Could not write XML data file: $!");
print TEMP_FILE $Xml;