Re: rrdcached: path sanitizer

Tobias Oetiker <[email protected]> Wed, 5 Dec 2012 17:37:48 +0100 (CET)
Newsgroups gmane.comp.db.rrdtool.devel
Message-ID <[email protected]>
Hi Gabor,

Friday Kiss Gabor (Bitman) wrote:

> I've just installed rrdcached and I'm checking its performance.
>
> I found that daemon does not sanitize file paths.
> Two different cliens may want to refer the same unix file
> with different names but rrdcached does not recognizes this
> but uses given filenames literally.
>
> E.g. Unix system calls "know" that the following files are the same
> /var/lib/cricket/subdir/foo.rrd and /var/lib/cricket//subdir/foo.rrd,
> /var/lib/cricket/subdir/bar.rrd and /var/lib/cricket/./subdir/bar.rrd
> etc.
> Meanwhile rrdcache thinks they are different.
> This may be problem when one program updates RRD file and an other
> one tries to flush cache before graphing.
>
> Checking the source code I found that severeal request handlers
> call get_abs_path(&file, file_tmp), but then no one uses
> the content of file_tmp.
> Maybe this function could be replaced with an other that
> canonifies file paths. I.e. multiple slashes should be replaced
> with single one and "./" should be omitted.

or read the inode and the filesystem associated with the file, that
should also help to figure out what is the same ...

contributions welcome ...

cheers
tobi

>
> Regards
>
> Gabor
>
>
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [email protected] ++41 62 775 9902 / sb: -9900