aboutsummaryrefslogtreecommitdiff
path: root/ares
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-05-11 21:12:10 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-05-11 21:12:10 +0000
commit864f1a33666135db5a30c712a8fb189a5cbccba4 (patch)
treecb353fdd57be11a4a0520301e40638e7a5fc4e3c /ares
parentf42b10242fdbcd06750f85ff511262e1088ff429 (diff)
- Nico Stappenbelt reported that when processing domain and search lines in
the resolv.conf file, the first entry encountered is processed and used as the search list. According to the manual pages for both Linux, Solaris and Tru64, the last entry of either a domain or a search field is used.
Diffstat (limited to 'ares')
-rw-r--r--ares/CHANGES8
-rw-r--r--ares/ares_init.c12
2 files changed, 18 insertions, 2 deletions
diff --git a/ares/CHANGES b/ares/CHANGES
index d4a21ada2..9558c84b9 100644
--- a/ares/CHANGES
+++ b/ares/CHANGES
@@ -1,5 +1,13 @@
Changelog for the c-ares project
+* May 11
+- Nico Stappenbelt reported that when processing domain and search lines in
+ the resolv.conf file, the first entry encountered is processed and used as
+ the search list. According to the manual pages for both Linux, Solaris and
+ Tru64, the last entry of either a domain or a search field is used.
+
+ This is now adjusted in the code
+
Version 1.2.0 (April 13, 2004)
* April 2, 2004
diff --git a/ares/ares_init.c b/ares/ares_init.c
index 41598e6ed..09062ac80 100644
--- a/ares/ares_init.c
+++ b/ares/ares_init.c
@@ -437,11 +437,11 @@ DhcpNameServer
return (errno == ENOENT) ? ARES_SUCCESS : ARES_EFILE;
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{
- if ((p = try_config(line, "domain")) && channel->ndomains == -1)
+ if ((p = try_config(line, "domain")))
status = config_domain(channel, p);
else if ((p = try_config(line, "lookup")) && !channel->lookups)
status = config_lookup(channel, p);
- else if ((p = try_config(line, "search")) && channel->ndomains == -1)
+ else if ((p = try_config(line, "search")))
status = set_search(channel, p);
else if ((p = try_config(line, "nameserver")) && channel->nservers == -1)
status = config_nameserver(&servers, &nservers, p);
@@ -702,6 +702,14 @@ static int set_search(ares_channel channel, const char *str)
int n;
const char *p, *q;
+ if(channel->ndomains != -1) {
+ /* if we already have some domains present, free them first */
+ for(n=0; n < channel->ndomains; n++)
+ free(channel->domains[n]);
+ free(channel->domains);
+ channel->ndomains = -1;
+ }
+
/* Count the domains given. */
n = 0;
p = str;