From: Vsevolod Stakhov Date: Fri, 2 May 2014 11:46:12 +0000 (+0100) Subject: Fix issues with resolving v4/v6 addresses for bind. X-Git-Tag: 0.7.0~233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9a308dad408f6bc60ac522ccd0d1ec1479aa216;p=thirdparty%2Frspamd.git Fix issues with resolving v4/v6 addresses for bind. --- diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index f2b56b364a..d041faa50c 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -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);