aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/librdns/util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-14 09:30:08 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-14 09:30:08 +0100
commit639c67dbd85d566d04c87a2f6ec59fd9b5ffe54a (patch)
tree246f12e74d8020008026bdffed1399dc95987850 /contrib/librdns/util.c
parent9ee06af6e58a973d58bb5f749eed6b97dc3fe989 (diff)
downloadrspamd-639c67dbd85d566d04c87a2f6ec59fd9b5ffe54a.tar.gz
rspamd-639c67dbd85d566d04c87a2f6ec59fd9b5ffe54a.zip
[Fix] Fix parsing IPv6 nameservers in resolv.conf
Diffstat (limited to 'contrib/librdns/util.c')
-rw-r--r--contrib/librdns/util.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/librdns/util.c b/contrib/librdns/util.c
index 9ea8f5c43..aa31c96b7 100644
--- a/contrib/librdns/util.c
+++ b/contrib/librdns/util.c
@@ -556,6 +556,7 @@ rdns_resolver_parse_resolv_conf_cb (struct rdns_resolver *resolver,
{
FILE *in;
char buf[BUFSIZ];
+ char *p;
in = fopen (path, "r");
@@ -568,6 +569,13 @@ rdns_resolver_parse_resolv_conf_cb (struct rdns_resolver *resolver,
break;
}
+ /* Strip trailing spaces */
+ p = buf + strlen (buf) - 1;
+ while (p > buf &&
+ (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n')) {
+ *p-- = '\0';
+ }
+
if (!rdns_resolver_conf_process_line (resolver, buf, cb, ud)) {
rdns_warn ("rdns_resolver_parse_resolv_conf: cannot parse line: %s", buf);
fclose (in);