NAPTR regex escape issues

Ben Turner ext.ben.turner at
Thu Jan 27 11:48:12 UTC 2005


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:  IN NAPTR 100 10 "U" "E2U+sip" "!^.*$!sip:\\1 at!"  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 NAPTR 100 20 "U" "E2U+sip" "!^.*$!sip:\\1 at!" .
    --> \\1 instead of \1 ? 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.



Ben Turner (Consultant)
tel: +32 14 252326

More information about the bind-users mailing list