summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5fa0bf3)
raw | patch | inline | side by side (parent: 5fa0bf3)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 1 Mar 2007 11:17:35 +0000 (12:17 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 1 Mar 2007 11:17:35 +0000 (12:17 +0100) |
Since the `DataDir' of the `csv' and `rrdtool' plugins are seperate from the
`BaseDir' setting, it makes sense to allow absolute directories here. The
(possibly more secure) alternative would be to disallow absolute directories
and force the user to create SymLinks instead.
`BaseDir' setting, it makes sense to allow absolute directories here. The
(possibly more secure) alternative would be to disallow absolute directories
and force the user to create SymLinks instead.
src/common.c | patch | blob | history |
diff --git a/src/common.c b/src/common.c
index 365b74f30091599c8d4d703da184c899cd20e26a..fc34afe7fcbed19a85e6563b498b1310d6fe619a 100644 (file)
--- a/src/common.c
+++ b/src/common.c
int fields_num;
char *ptr;
int last_is_file = 1;
+ int path_is_absolute = 0;
int len;
int i;
*/
if (file_orig[len - 1] == '/')
last_is_file = 0;
+ if (file_orig[0] == '/')
+ path_is_absolute = 1;
/*
* Create a copy for `strtok' to destroy
/*
* Join the components together again
*/
- if (strjoin (dir, dir_len, fields, i + 1, "/") < 0)
+ dir[0] = '/';
+ if (strjoin (dir + path_is_absolute, dir_len - path_is_absolute,
+ fields, i + 1, "/") < 0)
{
syslog (LOG_ERR, "strjoin failed: `%s', component #%i", file_orig, i);
return (-1);