diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-17 11:47:42 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-17 11:47:42 +0100 |
commit | 85cb173e351c97dc559f1319ad2fc5ec8efd3bbf (patch) | |
tree | f42ae64d00143cef963073b2f750a62225598d82 | |
parent | 1ccc6692099e609b900221582b090d41be4e40b8 (diff) | |
download | rspamd-85cb173e351c97dc559f1319ad2fc5ec8efd3bbf.tar.gz rspamd-85cb173e351c97dc559f1319ad2fc5ec8efd3bbf.zip |
Parse comma separated lists in rspamd_rcl_parse_struct_string_list.
-rw-r--r-- | src/libserver/cfg_rcl.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index 7b2bae767..05ba79eda 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -1953,7 +1953,7 @@ rspamd_rcl_parse_struct_string_list (rspamd_mempool_t *pool, { struct rspamd_rcl_struct_parser *pd = ud; GList **target; - gchar *val; + gchar *val, **strvec, **cvec; const ucl_object_t *cur; const gsize num_str_len = 32; ucl_object_iter_t iter = NULL; @@ -1965,8 +1965,18 @@ rspamd_rcl_parse_struct_string_list (rspamd_mempool_t *pool, while ((cur = ucl_object_iterate_safe (iter, true)) != NULL) { switch (cur->type) { case UCL_STRING: - val = rspamd_mempool_strdup (pool, ucl_copy_value_trash (cur)); - break; + strvec = g_strsplit_set (ucl_object_tostring (cur), ",", -1); + cvec = strvec; + + while (*cvec) { + *target = g_list_prepend (*target, + rspamd_mempool_strdup (pool, *cvec)); + cvec ++; + } + + g_strfreev (strvec); + /* Go to the next object */ + continue; case UCL_INT: val = rspamd_mempool_alloc (pool, num_str_len); rspamd_snprintf (val, num_str_len, "%L", cur->value.iv); |