Regexp issue in NAPTR rewrite

Kevin Darcy kcd at chrysler.com
Tue May 12 17:09:55 UTC 2009


I don't claim to be competent with NAPTR records -- having never used 
them in production -- but from the RFC (2915), it appears you need to 
express those backslashes, in the wire format of the NAPTR record, as 
*double* backslashes in the zone file:

For the case of the cid.urn.arpa record above,
   the regular expression entered into the master file should be
   "/urn:cid:.+@([^\\.]+\\.)(.*)$/\\2/i".  When the client code actually
   receives the record, the pattern will have been converted to
   "/urn:cid:.+@([^\.]+\.)(.*)$/\2/i".

[...]

Beware of regular expressions.  Not only are they difficult to get
   correct on their own, but there is the previously mentioned
   interaction with DNS.  Any backslashes in a regexp must be entered
   twice in a zone file in order to appear once in a query response.
   More seriously, the need for double backslashes has probably not been
   tested by all implementors of DNS servers.

									- Kevin


sandoche BALAKRICHENAN wrote:
>
> I want to rewrite a query of the form 
> "sgtin.5.4.0.0.0.1.3.2.4.5.6.7.6.id.onsam.test" to 
> "sgtin.5.4.0.0.0.1.3.2.4.5.6.7.6.id.onseu.test" using NAPTR rewrite.
>
> The NAPTR RR in the zone config is as follows:
>
> sgtin.5.4.0.0.0.1.3.2.4.5.6.7.6.id.onsam.test        IN     NAPTR    
> 0    0    "r"    ""      "!^sgtin\.([0-9])$!\1.id.onseu.test!"    .
>
> BIND does not  accept backref "\1" . It shows a syntax error.
>
> Is the above regexp correct?
>
>
>
>
>
>
> _______________________________________________
> bind-users mailing list
> bind-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/bind-users




More information about the bind-users mailing list