diff --git a/src/common.c b/src/common.c
index db8fce1a99f63b9691595adcfe96a7cc511902d9..4d93f4aa2764f5394c2336a3db889ebecc87d24c 100644 (file)
--- a/src/common.c
+++ b/src/common.c
*/
for (i = 0; i < (fields_num - last_is_file); i++)
{
- /*
- * Join the components together again
- */
- if (strjoin (dir, dir_len, fields, i + 1, "/") < 0)
- return (-1);
-
/*
* Do not create directories that start with a dot. This
* prevents `../../' attacks and other likely malicious
*/
if (fields[i][0] == '.')
{
- syslog (LOG_ERR, "Cowardly refusing to create a directory that begins with a `.' (dot): `%s'", dir);
+ syslog (LOG_ERR, "Cowardly refusing to create a directory that begins with a `.' (dot): `%s'", file_orig);
return (-2);
}
+ /*
+ * Join the components together again
+ */
+ if (strjoin (dir, dir_len, fields, i + 1, "/") < 0)
+ {
+ syslog (LOG_ERR, "strjoin failed: `%s', component #%i", file_orig, i);
+ return (-1);
+ }
+
if (stat (dir, &statbuf) == -1)
{
if (errno == ENOENT)
int i, j;
int status = 0;
+ if (check_create_dir (filename))
+ return (-1);
+
argc = ds_num + rra_num + 4;
if ((argv = (char **) malloc (sizeof (char *) * (argc + 1))) == NULL)
/* host == NULL => local mode */
if (host != NULL)
{
- if (check_create_dir (host))
- return (-1);
-
if (snprintf (full_file, 1024, "%s/%s", host, file) >= 1024)
return (-1);
}