Re: Regexp issue in NAPTR rewrite
Mark Andrews wrote: In message 4a093b9c.5060...@afnic.fr, sandoche BALAKRICHENAN writes: 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.testIN NAPTR 00r !^sgtin\.([0-9])$!\1.id.onseu.test!. BIND does not accept backref \1 . It shows a syntax error. Is the above regexp correct? You failed to properly escape the string. From RFC2168. Recall that the regular expression used \2 to extract a domain name from the CID, and \. for matching the literal '.' characters seperating the domain name components. Since '\' is the escape character, literal occurances of a backslash must be escaped by another backslash. For the case of the cid.urn.net record above, the regular expression entered into the zone 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. Thanks. With double \\ it works. begin:vcard fn:Sandoche BALAKRICHENAN n:;Sandoche BALAKRICHENAN org:AFNIC email;internet:sandoche.balakriche...@afnic.fr title:Ingenieur RD note;quoted-printable:Move Together=0D=0A= x-mozilla-html:FALSE version:2.1 end:vcard ___ bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users
Regexp issue in NAPTR rewrite
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.testIN NAPTR 00r !^sgtin\.([0-9])$!\1.id.onseu.test!. BIND does not accept backref \1 . It shows a syntax error. Is the above regexp correct? begin:vcard fn:Sandoche BALAKRICHENAN n:;Sandoche BALAKRICHENAN org:AFNIC email;internet:sandoche.balakriche...@afnic.fr title:Ingenieur RD note;quoted-printable:Move Together=0D=0A= x-mozilla-html:FALSE version:2.1 end:vcard ___ bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users
Re: Regexp issue in NAPTR rewrite
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.testIN NAPTR 00r !^sgtin\.([0-9])$!\1.id.onseu.test!. BIND does not accept backref \1 . It shows a syntax error. Is the above regexp correct? NAPTR might not be the only way to express what you're trying to do. Without knowing quite what that is [ 8-) ], I wonder whether you couldn't make do with a simple CNAME? The right-hand-side provisioning would then repeat part of the owner-name; this would be ugly, but would probably involve lighter application processing. /Niall ___ bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users
Re: Regexp issue in NAPTR rewrite
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.testIN NAPTR 00r !^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@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users ___ bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users
Re: Regexp issue in NAPTR rewrite
In message 4a093b9c.5060...@afnic.fr, sandoche BALAKRICHENAN writes: 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.testIN NAPTR 00r !^sgtin\.([0-9])$!\1.id.onseu.test!. BIND does not accept backref \1 . It shows a syntax error. Is the above regexp correct? You failed to properly escape the string. From RFC2168. Recall that the regular expression used \2 to extract a domain name from the CID, and \. for matching the literal '.' characters seperating the domain name components. Since '\' is the escape character, literal occurances of a backslash must be escaped by another backslash. For the case of the cid.urn.net record above, the regular expression entered into the zone 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. -- Mark Andrews, ISC 1 Seymour St., Dundas Valley, NSW 2117, Australia PHONE: +61 2 9871 4742 INTERNET: mark_andr...@isc.org ___ bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users