diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-11-13 18:17:00 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-11-13 18:17:00 +0000 |
commit | 2a0a59ee52a424d10bc7d1d5d77c451b842d8e00 (patch) | |
tree | b7c03551c82a4327c12a1aa438df29aa3b0078ed /src/cfg_rcl.c | |
parent | 3893d490abaa275fcadf180ff4ffc88e159f5c04 (diff) | |
download | rspamd-2a0a59ee52a424d10bc7d1d5d77c451b842d8e00.tar.gz rspamd-2a0a59ee52a424d10bc7d1d5d77c451b842d8e00.zip |
Expand path in file maps.
Diffstat (limited to 'src/cfg_rcl.c')
-rw-r--r-- | src/cfg_rcl.c | 20 |
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); |