summaryrefslogtreecommitdiffstats
path: root/src/cfg_rcl.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-11-13 18:17:00 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-11-13 18:17:00 +0000
commit2a0a59ee52a424d10bc7d1d5d77c451b842d8e00 (patch)
treeb7c03551c82a4327c12a1aa438df29aa3b0078ed /src/cfg_rcl.c
parent3893d490abaa275fcadf180ff4ffc88e159f5c04 (diff)
downloadrspamd-2a0a59ee52a424d10bc7d1d5d77c451b842d8e00.tar.gz
rspamd-2a0a59ee52a424d10bc7d1d5d77c451b842d8e00.zip
Expand path in file maps.
Diffstat (limited to 'src/cfg_rcl.c')
-rw-r--r--src/cfg_rcl.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/cfg_rcl.c b/src/cfg_rcl.c
index 6fc92ed19..557c532e8 100644
--- a/src/cfg_rcl.c
+++ b/src/cfg_rcl.c
@@ -1151,8 +1151,12 @@ rspamd_rcl_parse_struct_string (struct config_file *cfg, ucl_object_t *obj,
target = (gchar **)(((gchar *)pd->user_struct) + pd->offset);
switch (obj->type) {
case UCL_STRING:
- /* Direct assigning is safe, as object is likely linked to the cfg mem_pool */
- *target = ucl_copy_value_trash (obj);
+ if (pd->flags & RSPAMD_CL_FLAG_STRING_PATH) {
+ *target = rspamd_expand_path (cfg->cfg_pool, ucl_copy_value_trash (obj));
+ }
+ else {
+ *target = memory_pool_strdup (cfg->cfg_pool, ucl_copy_value_trash (obj));
+ }
break;
case UCL_INT:
*target = memory_pool_alloc (cfg->cfg_pool, num_str_len);
@@ -1171,10 +1175,6 @@ rspamd_rcl_parse_struct_string (struct config_file *cfg, ucl_object_t *obj,
return FALSE;
}
- if (pd->flags & RSPAMD_CL_FLAG_STRING_PATH) {
- *target = (gchar *)rspamd_expand_path (cfg->cfg_pool, *target);
- }
-
return TRUE;
}
@@ -1322,8 +1322,12 @@ rspamd_rcl_parse_struct_string_list (struct config_file *cfg, ucl_object_t *obj,
for (cur = obj; cur != NULL; cur = cur->next) {
switch (cur->type) {
case UCL_STRING:
- /* Direct assigning is safe, as curect is likely linked to the cfg mem_pool */
- val = ucl_copy_value_trash (obj);
+ if (pd->flags & RSPAMD_CL_FLAG_STRING_PATH) {
+ val = rspamd_expand_path (cfg->cfg_pool, ucl_copy_value_trash (obj));
+ }
+ else {
+ val = memory_pool_strdup (cfg->cfg_pool, ucl_copy_value_trash (obj));
+ }
break;
case UCL_INT:
val = memory_pool_alloc (cfg->cfg_pool, num_str_len);