|
|
|
@ -1153,20 +1153,24 @@ static int init_by_resolv_conf(ares_channel channel) |
|
|
|
|
FILE *fp; |
|
|
|
|
size_t linesize; |
|
|
|
|
int error; |
|
|
|
|
int update_domains; |
|
|
|
|
|
|
|
|
|
/* Don't read resolv.conf and friends if we don't have to */ |
|
|
|
|
if (ARES_CONFIG_CHECK(channel)) |
|
|
|
|
return ARES_SUCCESS; |
|
|
|
|
|
|
|
|
|
/* Only update search domains if they're not already specified */ |
|
|
|
|
update_domains = (channel->ndomains == -1); |
|
|
|
|
|
|
|
|
|
fp = fopen(PATH_RESOLV_CONF, "r"); |
|
|
|
|
if (fp) { |
|
|
|
|
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) |
|
|
|
|
{ |
|
|
|
|
if ((p = try_config(line, "domain", ';'))) |
|
|
|
|
if ((p = try_config(line, "domain", ';')) && update_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", ';')) && update_domains) |
|
|
|
|
status = set_search(channel, p); |
|
|
|
|
else if ((p = try_config(line, "nameserver", ';')) && |
|
|
|
|
channel->nservers == -1) |
|
|
|
|