aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorCristian Toader <cristian.matei.toader@gmail.com>2013-08-19 11:41:46 +0300
committerCristian Toader <cristian.matei.toader@gmail.com>2013-08-19 11:41:46 +0300
commita9910d89f170933a7730798c98ebbb1d743a1c46 (patch)
tree49bd606e410a7ca8b70ba1f711ad7e00afc17180 /src/or
parentc09b11b6d8595ef9d39f39d2060497e67cf3e756 (diff)
downloadtor-a9910d89f170933a7730798c98ebbb1d743a1c46.tar
tor-a9910d89f170933a7730798c98ebbb1d743a1c46.tar.gz
finalised fix on libevent open string issue
Diffstat (limited to 'src/or')
-rw-r--r--src/or/dns.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index 6dc0c05f9..09601e9cb 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -1444,13 +1444,14 @@ configure_nameservers(int force)
const or_options_t *options;
const char *conf_fname;
struct stat st;
- int r;
+ int r, flags;
options = get_options();
conf_fname = options->ServerDNSResolvConfFile;
#ifndef _WIN32
if (!conf_fname)
conf_fname = "/etc/resolv.conf";
#endif
+ flags = DNS_OPTIONS_ALL;
if (!the_evdns_base) {
if (!(the_evdns_base = evdns_base_new(tor_libevent_get_base(), 0))) {
@@ -1492,9 +1493,14 @@ configure_nameservers(int force)
evdns_base_search_clear(the_evdns_base);
evdns_base_clear_nameservers_and_suspend(the_evdns_base);
}
+ if (flags & DNS_OPTION_HOSTSFILE) {
+ flags ^= DNS_OPTION_HOSTSFILE;
+ evdns_base_load_hosts(the_evdns_base,
+ sandbox_intern_string("/etc/resolv.conf"));
+ }
log_info(LD_EXIT, "Parsing resolver configuration in '%s'", conf_fname);
- if ((r = evdns_base_resolv_conf_parse(the_evdns_base,
- DNS_OPTIONS_ALL, conf_fname))) {
+ if ((r = evdns_base_resolv_conf_parse(the_evdns_base, flags,
+ sandbox_intern_string(conf_fname)))) {
log_warn(LD_EXIT, "Unable to parse '%s', or no nameservers in '%s' (%d)",
conf_fname, conf_fname, r);
goto err;