summaryrefslogtreecommitdiffstats
path: root/src/libutil/upstream.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-15 14:56:25 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-15 14:56:25 +0000
commitaddeca94a989343bc4339dd7fffac4bb3329aaa1 (patch)
treec5f719a446fce0ecbbc2a46a9b402190eaa5da68 /src/libutil/upstream.c
parent61f5955c49d8846fec3e4deaa9d49c7ac3823888 (diff)
downloadrspamd-addeca94a989343bc4339dd7fffac4bb3329aaa1.tar.gz
rspamd-addeca94a989343bc4339dd7fffac4bb3329aaa1.zip
[Fix] Fix parsing upstreams from UCL
Diffstat (limited to 'src/libutil/upstream.c')
-rw-r--r--src/libutil/upstream.c17
1 files 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;
}