Re: unescaped double quotes in TXT record

[email protected] (Paul Jarc) Mon, 24 May 2010 09:58:13 -0400
Newsgroups gmane.network.djbdns
Organization What did you have in mind? A short, blunt, human pyramid?
Message-ID <[email protected]>
Hugo Monteiro <[email protected]> wrote:
> Then there is the need to setup a TXT record which holds multiple
> double quotes.

The quotes aren't actually part of the record content.  They're shown
by dig to let you know how the TXT record is divided into segments.
If you remove the quotes from your tinydns data file, you'll get the
correct record content, but ' lines don't let you control the segment
divisions.  If your application cares about that difference, you might
need to use a : line instead.

> The thing is that tinydns escapes those quotes, as we can see in
> this dig question/answer pair:
>
> ;; QUESTION SECTION:
> ;hp_4050._ipp._tcp.dev.hmonteiro.net.    IN    TXT
>
> ;; ANSWER SECTION:
> hp_4050._ipp._tcp.dev.hmonteiro.net. 60 IN    TXT    "\"qtotl=1\"
> \"rp=printers/HP\" \"ty=HP LaserJet 4050 Series PS\" \"product=(HP
> LaserJet 4050 Series)\" \"pdl=application/postscript\""

What's actually happening here is that dig added an unescaped set of
quotes around the whole record, indicating that the entire record is a
single segment.  Then dig also escaped the quotes that are part of the
record content received from tinydns, to distinguish them from the
segment-delimiting quotes.

> ;; ANSWER SECTION:
> xerox_phaser_6130n._ipp._tcp.dev.hmonteiro.net.    60 IN TXT "qtotl=1"
> "rp=printers/xerox6130n" "ty=Xerox Phaser 6130N" "product=(Phaser
> 6130N)" "pdl=application/postscript"

In this case, the unescaped quotes added by dig show that the record
is divided into several segments.  There are no quotes that are
actually part of the record content; if there were, dig would have
escaped them.


paul