NLnetLabs / ldns

LDNS is a DNS library that facilitates DNS tool programming
https://nlnetlabs.nl/ldns
BSD 3-Clause "New" or "Revised" License
295 stars 99 forks source link

ldns-read-zone appears to mangle TXT record #139

Closed gbxyz closed 3 years ago

gbxyz commented 3 years ago

Consider this TXT record:

example.com 3600 IN TXT "foo""bar"

it has two text segments, foo and bar, enclosed in quotes - but without a space in between. named-compilezone accepts RRs in this format, although it emits the same TXT record with a space between each segment.

However, ldns-read-zone produces this output:

example.com.    3600    IN  TXT "foo" "bar\""

The above output is mangled by the addition of \" to the last text segment.

named-compilezone is probably being too forgiving here (I can't find chapter and verse in an RFC about whether a space between two text segments is expected, but it seems to me like it should), but ldns-read-zone is definitely doing something wrong. It should either reject the RR or coerce it in the same way that named-compilezone does.

(ldns version: 1.7.1)

wtoorop commented 3 years ago

Fixed in 60773ee

gbxyz commented 3 years ago

Thanks @wtoorop! Do you know when this might find its way into a release?

FGasper commented 2 years ago

https://datatracker.ietf.org/doc/html/rfc1035#section-5.1 says:

Any combination of tabs and spaces act as a delimiter between the separate items that make up an entry.

Since the two character strings in the original TXT record are separate, ISTM per the RFC there should be at least one space or TAB between them; thus, the original TXT record is actually invalid.