dns: NAPTR Regex parse wrong double backslash according to RFC 2915
Greetings,
Today we try some scenario and found that the double backslashed are wrongly parsed.
According to RFC 2915 if you want to have a backslash you must escape that backslash with another backslash.
So in theory if the server send this string as a NAPTR Regex /urn:cid:.+@([^\\.]+\\.)(.*)$/\\2/i the client should receive /urn:cid:.+@([^\.]+\.)(.*)$/\2/i ( (Example1: https://tools.ietf.org/html/rfc2915#section-7.1 )
In our test we send the exact same string as regex :
/urn:cid:.+@([^\\.]+\\.)(.*)$/\\2/i
But the client receive the following :
/urn:cid:.+@([^\\.]+\\.)(.*)$/\\2/i
In case that server send the request with 1 backslash the client receive the request without backslash.
What server send :
/urn:cid:.+@([^\.]+\.)(.*)$/\2/i
What client receive :
/urn:cid:.+@([^.]+.)(.*)$/2/i
Additional information, in our code, we use a dns.ResponseWriter to send the message to the client ( https://github.com/cgrates/cgrates/blob/master/agents/libdns.go#L110-L117 )
Thanks, TeoV
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 20 (5 by maintainers)
thanks. That test is useful.
The issue as that in
packTxtStringwe check for\DDDsequences, but this eats the\in this case. And that is indeed a bug.