From addeca94a989343bc4339dd7fffac4bb3329aaa1 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 15 Mar 2016 14:56:25 +0000 Subject: [PATCH] [Fix] Fix parsing upstreams from UCL --- src/libutil/upstream.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c index a49a8a222..9187ba9b9 100644 --- a/src/libutil/upstream.c +++ b/src/libutil/upstream.c @@ -651,17 +651,16 @@ rspamd_upstreams_from_ucl (struct upstream_list *ups, const ucl_object_t *cur; ucl_object_iter_t it = NULL; - if (ucl_object_type (in) == UCL_ARRAY) { - while ((cur = ucl_object_iterate (in, &it, true)) != NULL) { - if (rspamd_upstreams_from_ucl (ups, cur, def_port, data)) { - ret = TRUE; - } + it = ucl_object_iterate_new (in); + + while ((cur = ucl_object_iterate_safe (it, true)) != NULL) { + if (ucl_object_type (cur) == UCL_STRING) { + ret = rspamd_upstreams_parse_line (ups, ucl_object_tostring (cur), + def_port, data); } } - else if (ucl_object_type (in) == UCL_STRING) { - ret = rspamd_upstreams_parse_line (ups, ucl_object_tostring (in), - def_port, data); - } + + ucl_object_iterate_free (it); return ret; } -- 2.39.5