Hi James,
On Sat, Mar 19, 2011 at 11:29:38AM +0000, James Beckett wrote:
On 18/03/2011 15:24, Andy Smith wrote:
At the moment the impact is that if you have a
DNS zone with
something like this in it:
foo\032bar._http._tcp SRV 0 0 10
baz.example.com.
then it will get stored in
b.authns.bitfolk.com and
c.authns.bitfolk.com as:
foo bar._http._tcp SRV 0 0 10
baz.example.com.
This is incorrect.
Although it's apparent there's a genuine bug somewhere, I think the
query tools (dig,host,nslookup) are counter-intuitive here. I would
always read "\032" as an octal escape, but apparently that's how
these tools present a space characters (plain ascii decimal 32).
RFC1035 (
http://www.rfc-archive.org/getrfc.php?rfc=1035) says:
The labels in the domain name are expressed as character
strings and separated by dots.
[...]
Because these files are text files several special encodings
are necessary to allow arbitrary data to be loaded. In
particular:
[...]
\DDD where each D is a digit is the octet corresponding
to the decimal number described by DDD. The
resulting octet is assumed to be text and is not
checked for special meaning.
Your example of "foo bar" being stored then
seems to be correct -
how are you distinguishing "stored" v. "presented by query tool"?
BIND stores it in its zone files as "foo\032bar", and in every other
respect PowerDNS stores data in its databases using the same format
as BIND, so when I see a difference I suspect bug, but I agree it
does not have to store it the same way as long as it processes it
properly. But it doesn't.
If you're looking at the raw data in sqlite
I'd be unsurprised to
find real spaces there.
I suppose there is no reason why the databases couldn't use blobs
and binary data and turn \DDD into single bytes. But the dominant
DNS server is BIND and its zone file format is well understood, so I
can see why PowerDNS just stores that in text fields of its
databases.
(I just tried both of these in my main zone file:
spaced\ out IN CNAME @
spaced\032out2 IN CNAME @
- both then are queryable with either " " or "\\032" in the name,
and always return the escaped version. strace/tcpdump show the wire
traffic as using real spaces.)
Interesting!
Cheers,
Andy