New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#21900: Fallback to local DNS when no other nameservers are known #273
Conversation
src/feature/relay/dns.c
Outdated
return 0; | ||
} | ||
|
||
if (st.st_size == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the stat() call failed above, then at this point, st.st_size will be uninitialized, and we're not allowed to look at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking if stat()
succeeded in 770aee4.
src/feature/relay/dns.c
Outdated
#endif /* defined(dns_option_hostsfile) && defined(use_libseccomp) */ | ||
|
||
if (!missing_resolv_conf) { | ||
log_info(LD_EXIT, "parsing resolver configuration in '%s'", conf_fname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this log message, and the messages after it, are still lower-cased in the latest version of the branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted the last changes to lowercase in 917eeed.
src/feature/relay/dns.c
Outdated
resolv_conf_fname = tor_strdup(conf_fname); | ||
resolv_conf_mtime = st.st_mtime; | ||
} else { | ||
log_warn(LD_EXIT, "Could not read your resolv.conf - " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message should say what actual filename it tried to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging filename in a1656c9.
src/feature/relay/dns.c
Outdated
} | ||
|
||
tor_free(resolv_conf_fname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tor_free() here will clear the value of rsolv_conf_fname that you set above...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed - 4c1913a.
log_warn(LD_EXIT, "unable to find any nameservers in '%s'.", | ||
conf_fname); | ||
} | ||
resolv_conf_fname = tor_strdup(conf_fname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If resolv_conf_fname was already set, this will leak memory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…_addr() is not available
Closing in favor of PR 425 |
https://trac.torproject.org/projects/tor/ticket/21900