fix: Fixed IPv6 host renaming (#7275)

* Fixed IPv6 host renaming

* Added get_rrd_dir() and modified other files to use it where appropriate.

* rrd_name() now uses the new function get_rrd_dir(), to make it simpler to modify the escaping in the future.

* Wrong function name in rrdstep.php
This commit is contained in:
Zmegolaz
2017-09-02 20:45:31 +02:00
committed by Tony Murray
parent b85269f00e
commit 5441bafc81
13 changed files with 29 additions and 16 deletions

View File

@@ -300,10 +300,24 @@ function rrd_name($host, $extra, $extension = ".rrd")
{
global $config;
$filename = safename(is_array($extra) ? implode("-", $extra) : $extra);
$host = str_replace(':', '_', trim($host, '[]'));
return implode("/", array($config['rrd_dir'], $host, $filename.$extension));
return implode("/", array(get_rrd_dir($host), $filename.$extension));
} // rrd_name
/**
* Generates a path based on the hostname (or IP)
*
* @param string $host Host name
* @return string the name of the rrd directory for $host
*/
function get_rrd_dir($host)
{
global $config;
$host = str_replace(':', '_', trim($host, '[]'));
return implode("/", array($config['rrd_dir'], $host));
} // rrd_dir
/**
* Generates a filename for a proxmox cluster rrd
*