Closed grembo closed 2 months ago
FreeBSD bug tracker: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278721
Hopefully found a title that makes more sense now 😄
- Make
ldns_fget_token_l_st
understand comments starting with#
(unclear which side-effects this might have)
Thank you @grembo . I prefer that one, and then remove all comment handling from resolver.c. I just added a bit more (in PR #238) so that zonefile parsing does not accept comments to start with '#' too.
Fixed by #238, thank you guys!
And thank you for reporting!
@dag-erling I've put a bugfix release on the calender for June.
TL;DR
Comment parsing in /etc/resolv.conf is broken since 889f7c7195bbd3
How to reproduce
Create a basic resolv.conf containing comments:
Then run drill on some zone:
Expected outcome
Since there are no nameservers configured, this outcome would be expected:
Actual outcome
The commented out nameserver entry is used:
Analysis
Commit 889f7c7195bbd306f8c introduced this change:
Which breaks comment handling in resolver.c, which only removes characters until the end of line, in case line_nr doesn't change:
Potential Fixes
The parser isn't necessarily the kind of code one just jumps into and reasons about, yet the three suggestions below worked for my limited use case:
Make
ldns_fget_token_l_st
understand comments starting with#
(unclear which side-effects this might have)Real life resolv.conf
This is the configuration where we first encountered issues (it would request a local zone from google DNS and fail with NXDOMAIN, even though we would expect the call to be handled by unbound running locally)