aboutsummaryrefslogtreecommitdiff
path: root/src/or/eventdns.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-12-19 19:49:03 +0000
committerNick Mathewson <nickm@torproject.org>2006-12-19 19:49:03 +0000
commitbaadf35c639022d81ae906e4c9b14f6c4583ae40 (patch)
tree035c53cd429d46930ba04b88fa20130b7757302b /src/or/eventdns.c
parentbf6702cf8b8f251356b72a8276fefbdeb6eca453 (diff)
downloadtor-baadf35c639022d81ae906e4c9b14f6c4583ae40.tar.gz
tor-baadf35c639022d81ae906e4c9b14f6c4583ae40.zip
r11646@Kushana: nickm | 2006-12-19 14:40:38 -0500
Resolve bug 363: do not fall back to 127.0.0.1 when no nameservers are configured. Instead, have the admin fix resolv.conf or configure a nameserver. svn:r9157
Diffstat (limited to 'src/or/eventdns.c')
-rw-r--r--src/or/eventdns.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/or/eventdns.c b/src/or/eventdns.c
index 68a2f6c203..ebc110195d 100644
--- a/src/or/eventdns.c
+++ b/src/or/eventdns.c
@@ -2499,7 +2499,7 @@ resolv_conf_parse_line(char *const start, int flags) {
char *const first_token = strtok_r(start, delims, &strtok_state);
if (!first_token) return;
- if (!strcmp(first_token, "nameserver")) {
+ if (!strcmp(first_token, "nameserver") && (flags & DNS_OPTION_NAMESERVERS)) {
const char *const nameserver = NEXT_TOKEN;
struct in_addr ina;
@@ -2579,7 +2579,7 @@ evdns_resolv_conf_parse(int flags, const char *const filename) {
if (fstat(fd, &st)) { err = 2; goto out1; }
if (!st.st_size) {
evdns_resolv_set_defaults(flags);
- err = 0;
+ err = (flags & DNS_OPTION_NAMESERVERS) ? 6 : 0;
goto out1;
}
if (st.st_size > 65535) { err = 3; goto out1; } // no resolv.conf should be any bigger
@@ -2608,6 +2608,7 @@ evdns_resolv_conf_parse(int flags, const char *const filename) {
if (!server_head && (flags & DNS_OPTION_NAMESERVERS)) {
// no nameservers were configured.
evdns_nameserver_ip_add("127.0.0.1");
+ err = 6;
}
if (flags & DNS_OPTION_SEARCH && (!global_search_state || global_search_state->num_domains == 0)) {
search_set_from_hostname();