]> source.dussan.org Git - rspamd.git/commitdiff
Fix nameservers setup.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 12 Feb 2014 12:31:54 +0000 (12:31 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 12 Feb 2014 12:34:32 +0000 (12:34 +0000)
Conflicts:

src/dns.c

src/cfg_rcl.c
src/dns.c

index f719e239fa12c415d8f85012f85732e81341136c..0dc41689ba1fa6bf44ef8ca53604ef6c649576ca 100644 (file)
@@ -1423,6 +1423,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);
 
@@ -1431,10 +1432,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);
index 5bd7766d697fa3ae97fb06d017f5ef9dc870938b..5ec372f17ef6b2dd91cd32b08d20cd08198fde73 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -1486,11 +1486,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) {
@@ -1510,14 +1512,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 = memory_pool_strdup (new->static_pool, 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;
                        }