From owner-freebsd-current@FreeBSD.ORG Mon Dec 15 02:48:08 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 871931065676 for ; Mon, 15 Dec 2008 02:48:08 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx22.fluidhosting.com [204.14.89.5]) by mx1.freebsd.org (Postfix) with ESMTP id F1B478FC16 for ; Mon, 15 Dec 2008 02:48:07 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: (qmail 15607 invoked by uid 399); 15 Dec 2008 02:21:25 -0000 Received: from localhost (HELO ?192.168.0.4?) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 15 Dec 2008 02:21:25 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4945BF21.7080406@FreeBSD.org> Date: Sun, 14 Dec 2008 18:21:21 -0800 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) MIME-Version: 1.0 To: Eygene Ryabinkin References: <004901c95a1c$5c6b2680$15417380$@org> <493ECA0D.7090901@andric.com> In-Reply-To: X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Dimitry Andric , freebsd-current@freebsd.org, Larry Rosenman Subject: Re: Why does host and dig show a ; as \;? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Dec 2008 02:48:08 -0000 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