Date: Sun, 14 Dec 2008 18:21:21 -0800 From: Doug Barton <dougb@FreeBSD.org> To: Eygene Ryabinkin <rea-fbsd@codelabs.ru> Cc: Dimitry Andric <dimitry@andric.com>, freebsd-current@freebsd.org, Larry Rosenman <ler@lerctr.org> Subject: Re: Why does host and dig show a ; as \;? Message-ID: <4945BF21.7080406@FreeBSD.org> In-Reply-To: <b%2BMjVE/xHUFxXn67Dp5hNFnMq1c@U5Ym/LsUjF/pShfbLUXrQuw8cMs> References: <004901c95a1c$5c6b2680$15417380$@org> <493ECA0D.7090901@andric.com> <alpine.BSF.2.00.0812091344020.23053@thebighonker.lerctr.org> <b%2BMjVE/xHUFxXn67Dp5hNFnMq1c@U5Ym/LsUjF/pShfbLUXrQuw8cMs>
next in thread | previous in thread | raw e-mail | index | archive | help
Eygene Ryabinkin wrote:
> Larry, good day.
>
> Tue, Dec 09, 2008 at 01:49:27PM -0600, Larry Rosenman wrote:
>> On Tue, 9 Dec 2008, Dimitry Andric wrote:
>>> On 2008-12-09 17:36, Larry Rosenman wrote:
>>>> Why does the host command, dig, and a named_db.dump all show a ; as \; in a
>>>> TXT record?
>>> AFAICS the semicolon is a comment character in BIND software (at least
>>> in all config files and so on), and therefore it needs to be escaped.
>
> It doesn't need to be escaped inside strings themselves, at least there
> is no reason to have comments inside strings and BIND itself treats ';'
> inside strings as ordinary characters. But BIND's internal helper
> txt_totext does the escaping:
> ----- lib/dns/rdata.c
> /* double quote, semi-colon, backslash */
> if (*sp == 0x22 || *sp == 0x3b || *sp == 0x5c) {
> if (tl < 2)
> return (ISC_R_NOSPACE);
> *tp++ = '\\';
> tl--;
> }
> -----
> And BIND understands both escaped and unescaped semicolons inside
> strings in zone files -- it treats both of them in a same way.
>
> I don't have access to BIND's CVSWeb interface, so I can not trace the
> origin of semicolon escaping, but I feel that historically BIND treated
> semicolons inside strings as the plain symbols and this remained so to
> be backwards-compatible. And escaping in the BIND's output is the
> stricter form of string formatting. However, for example, our Russian
> TLD registrars are suggesting to avoid escapes inside strings if it is
> possible. Don't know why -- it is just a recipe without explanation.
>
> I am CC'ing Doug Barton, who maintains BIND for FreeBSD. Doug, is there
> any requirement for escaping the semicolons inside strings? I am
> failing to find it in http://www.ietf.org/rfc/rfc1035.txt: it talks
> about semicolons, but not about escaping and there seems to be no proper
> BNF notation for DNS zone files. Am I missing something?
I've never come across this, but if I had to guess I'd say that it does
so for maximum compatibility with a wide variety of DNS software.
Remember the robustness principle, "liberal in what you accept,
conservative in what you send."
hth,
Doug
--
This .signature sanitized for your protection
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4945BF21.7080406>
