Skip to content
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

fail parsing resolv.conf with escape sequence #38

Open
JyJyJcr opened this issue Dec 1, 2024 · 0 comments
Open

fail parsing resolv.conf with escape sequence #38

JyJyJcr opened this issue Dec 1, 2024 · 0 comments

Comments

@JyJyJcr
Copy link

JyJyJcr commented Dec 1, 2024

Describe the bug
/etc/resolv.conf with non-LDH escape sequence causes parse error.

To Reproduce

  1. add any domain containing non-LDH \-escape sequence to /etc/resolv.conf
  2. install something which uses hickory-resolver crate as the resolver
  3. execute it with system configuration = /etc/resolv.conf

Simplest example:

add space\032space.com into domain search list, then

cargo install hickory-util
resolve -s github.com

will fail with this error:

Error: ResolveError { kind: Io(Custom { kind: Other, error: "Error parsing resolv.conf: Malformed label: space\u{1a}space" }) }

Expected behavior

  1. the resolver should parse resolv.conf as vaild file
  2. if not, escape sequence should be unescaped as decimal escape

expected result of the example above:

Querying for github.com A from [system provided nameservers...]
Success for query github.com IN A
    github.com. 51 IN A 20.27.177.113
Error: ResolveError { kind: Io(Custom { kind: Other, error: "Error parsing resolv.conf: Malformed label: space\u{20}space" }) }

System:
1.

  • OS: linux
  • Architecture: aarch64
  • Version 6.6.51+rpt-rpi-v8
  • rustc version: 1.83
    • OS: macos
    • Architecture: aarch64
    • Version 6.6.51+rpt-rpi-v8
    • rustc version: 1.83

Version:
Crate: hickory-resolver
Version: 0.24.1

Additional context
when domain search list with non LDH characters provided, some DHCP client implementations use \-escape decimal sequences and put the escaped domains into /etc/resolv.conf:

This behavior corresponds with non-LDH escape defined in Section 2.1 of RFC 4343.

Strangely, ISC-DHCP use C-style octal escape sequence:

hickory-dns/hickory-dns#330 seems following ISC-DHCP.

@djc djc transferred this issue from hickory-dns/hickory-dns Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant