]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fix issues with resolving v4/v6 addresses for bind.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 2 May 2014 11:46:12 +0000 (12:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 2 May 2014 11:46:12 +0000 (12:46 +0100)
src/libserver/cfg_utils.c

index f2b56b364a7ab506c3e7cbe5112b2f03bfc73a83..d041faa50c0b481bad8922b8b8654b75649d7d95 100644 (file)
@@ -215,7 +215,6 @@ rspamd_parse_bind_line (struct rspamd_config *cfg, struct rspamd_worker_conf *cf
        if (*tokens[0] == '/' || *tokens[0] == '.') {
                cnf->ai = AF_UNIX;
                LL_PREPEND (cf->bind_conf, cnf);
-               return TRUE;
        }
        else if (strcmp (tokens[0], "*") == 0) {
                /* We need to add two listen entries: one for ipv4 and one for ipv6 */
@@ -245,12 +244,24 @@ rspamd_parse_bind_line (struct rspamd_config *cfg, struct rspamd_worker_conf *cf
                if (err == NULL || *err == '\0') {
                        LL_PREPEND (cf->bind_conf, cnf);
                }
+               else {
+                       ret = FALSE;
+               }
        }
        else {
-               if ((ret = parse_host_port_priority_strv (cfg->cfg_pool, tokens,
-                               &cnf->bind_host, &cnf->bind_port, NULL, DEFAULT_BIND_PORT))) {
+               cnf->bind_host = rspamd_mempool_strdup (cfg->cfg_pool, tokens[0]);
+               if (tokens[1] == NULL) {
+                       cnf->bind_port = DEFAULT_BIND_PORT;
+               }
+               else {
+                       cnf->bind_port = strtoul (tokens[1], &err, 10);
+               }
+               if (err == NULL || *err == '\0') {
                        LL_PREPEND (cf->bind_conf, cnf);
                }
+               else {
+                       ret = FALSE;
+               }
        }
 
        g_strfreev (tokens);