aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cfg_rcl.c5
-rw-r--r--src/dns.c19
2 files changed, 14 insertions, 10 deletions
diff --git a/src/cfg_rcl.c b/src/cfg_rcl.c
index be60c335c..5793b5010 100644
--- a/src/cfg_rcl.c
+++ b/src/cfg_rcl.c
@@ -1434,6 +1434,7 @@ rspamd_rcl_parse_struct_string_list (struct config_file *cfg, ucl_object_t *obj,
gchar *val;
ucl_object_t *cur;
const gsize num_str_len = 32;
+ ucl_object_iter_t iter = NULL;
target = (GList **)(((gchar *)pd->user_struct) + pd->offset);
@@ -1442,10 +1443,10 @@ rspamd_rcl_parse_struct_string_list (struct config_file *cfg, ucl_object_t *obj,
return FALSE;
}
- for (cur = obj; cur != NULL; cur = cur->next) {
+ while ((cur = ucl_iterate_object (obj, &iter, true)) != NULL) {
switch (cur->type) {
case UCL_STRING:
- val = memory_pool_strdup (cfg->cfg_pool, ucl_copy_value_trash (obj));
+ val = memory_pool_strdup (cfg->cfg_pool, ucl_copy_value_trash (cur));
break;
case UCL_INT:
val = memory_pool_alloc (cfg->cfg_pool, num_str_len);
diff --git a/src/dns.c b/src/dns.c
index 3d714c240..a74e5b692 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -1362,11 +1362,13 @@ dns_resolver_init (struct event_base *ev_base, struct config_file *cfg)
p ++;
if (!new->is_master_slave) {
priority = strtoul (p, &err, 10);
- if (err != NULL && (*err == 'm' || *err == 'M' || *err == 's' || *err == 'S')) {
- new->is_master_slave = TRUE;
- }
- else {
- msg_info ("bad character '%c', must be 'm' or 's' or a numeric priority", *err);
+ if (err != NULL && *err != '\0') {
+ if ((*err == 'm' || *err == 'M' || *err == 's' || *err == 'S')) {
+ new->is_master_slave = TRUE;
+ }
+ else {
+ msg_info ("bad character '%x', must be 'm' or 's' or a numeric priority", *err);
+ }
}
}
if (new->is_master_slave) {
@@ -1386,14 +1388,15 @@ dns_resolver_init (struct event_base *ev_base, struct config_file *cfg)
priority = 0;
}
serv = &new->servers[new->servers_num];
- if (inet_pton (AF_INET6, p, addr_holder) == 1 ||
- inet_pton (AF_INET, p, addr_holder) == 1) {
+ if (inet_pton (AF_INET6, begin, addr_holder) == 1 ||
+ inet_pton (AF_INET, begin, addr_holder) == 1) {
serv->name = strdup (begin);
serv->up.priority = priority;
+ serv->up.weight = priority;
new->servers_num ++;
}
else {
- msg_warn ("cannot parse ip address of nameserver: %s", p);
+ msg_warn ("cannot parse ip address of nameserver: %s", begin);
cur = g_list_next (cur);
continue;
}