NAPTR regex escape issues
Mark Andrews
Mark_Andrews at isc.org
Thu Jan 27 12:40:01 UTC 2005
> Hello,
>
> I am having trouble getting BIND to return regular expressions with
> escaped (meta) characters properly. I have an amount of NAPTR records
> which contain escaped backslashes (\\) and escaped metachars (i.e. \+).
>
> My problem lies in the fact that double backslashes in a zone file are
> returned as such - double backslashes. Single backslashes in the file
> are either dropped (i.e. in front of a +) or cause errors when in front
> of digits (for regex backreferences such as \1).
>
> For instance i have the following records in my enum.test zone file:
>
> 8.7.6.5.4.3.2.1.2.3 IN NAPTR 100 10 "U" "E2U+sip" "!^.*$!sip:\\1 at shire.me!
> "
> 8.7.6.5.4.3.2.1.2.3 IN NAPTR 100 20 "U" "E2U+sip" "!^\\+(32)(12\\d\\d)(56\
> \d\\d)$!sip:\\1@\\2-\\3!" .
>
> When queried this returns:
>
> # host -t NAPTR 8.7.6.5.4.3.2.1.2.3.enum.test
> 8.7.6.5.4.3.2.1.2.3.enum.test NAPTR 100 20 "U" "E2U+sip" "!^.*$!sip:\\1 at shi
> re.me!" .
> --> \\1 instead of \1 ?
> 8.7.6.5.4.3.2.1.2.3.enum.test NAPTR 100 50 "U" "E2U+sip" "!^\\+(32)(12\\d\\
> d)(56\\d\\d)$!sip:\\1@\\2-\\3!" .
> --> \\+ instead of \+ ? \\d instead of \d ?
>
> What is the intended behaviour for regular expression escape sequences
> in NAPTR records in zone files? Should clients be built to handle the
> double backslashes that are returned? Preferably BIND would immedeately
> be able to return the correct regex.
NAPTR records are expected be processed in their wire format
not their presentation format (inherited from TXT).
A backslash on the wire is \\.
A double quote is \".
A NUL is \000.
A carriage return is \013.
Dig and host put the record out such that it can be read back
in and produce the original wire format.
> Thanks,
>
> Ben
>
> --
> Ben Turner (Consultant)
> SIEMENS - IC MN D SU
> tel: +32 14 252326
>
>
--
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742 INTERNET: Mark_Andrews at isc.org
More information about the bind-users
mailing list