From ede92df93b90787ccc882ebcddc1d410b4f546e9 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Mon, 4 Apr 2011 15:33:46 +0100 Subject: [PATCH] Don't override ARES_OPT_DOMAINS with the values in resolv.conf --- ares_init.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ares_init.c b/ares_init.c index 75064e965..31115fc70 100644 --- a/ares_init.c +++ b/ares_init.c @@ -853,6 +853,12 @@ DhcpNameServer FILE *fp; size_t linesize; int error; + + int ignore_domains = 0; + + /* Don't override ARES_OPT_DOMAINS */ + if (channel->ndomains != -1) + ignore_domains = 1; /* Don't read resolv.conf and friends if we don't have to */ if (ARES_CONFIG_CHECK(channel)) @@ -862,11 +868,11 @@ DhcpNameServer if (fp) { while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) { - if ((p = try_config(line, "domain", ';'))) + if ((p = try_config(line, "domain", ';')) && !ignore_domains) status = config_domain(channel, p); else if ((p = try_config(line, "lookup", ';')) && !channel->lookups) status = config_lookup(channel, p, "bind", "file"); - else if ((p = try_config(line, "search", ';'))) + else if ((p = try_config(line, "search", ';')) && !ignore_domains) status = set_search(channel, p); else if ((p = try_config(line, "nameserver", ';')) && channel->nservers == -1)