Permalink
Browse files

fix backslash handling in TXT parser, includes test. Thanks jpmens

git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@3107 d19b8d6e-7fed-0310-83ef-9ca221ded41b
  • Loading branch information...
1 parent fb6ed6f commit 35261869c35deb72e6e089d9206e3cbee9d161df @Habbie Habbie committed Feb 28, 2013
@@ -61,7 +61,7 @@ vector<string> segmentDNSText(const string& input )
appendSplit(ret, segment, *(fpc));
}
- escaped = '\\' ((["\\]@reportEscaped) | ([0-9]{3}$reportEscapedNumber%doneEscapedNumber));
+ escaped = '\\' (([^0-9]@reportEscaped) | ([0-9]{3}$reportEscapedNumber%doneEscapedNumber));
plain = ((print-'\\'-'"')|'\n'|'\t') $ reportPlain;
txtElement = escaped | plain;
@@ -0,0 +1,5 @@
+#!/bin/sh
+cleandig text0.example.com TXT
+cleandig text1.example.com TXT
+cleandig text2.example.com TXT
+cleandig text3.example.com TXT
@@ -0,0 +1 @@
+4 TXT records with 0 to 3 backslashes before a semicolon.
@@ -0,0 +1,12 @@
+0 text0.example.com. IN TXT 120 "k=rsa; p=one"
+Rcode: 0, RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='text0.example.com.', qtype=TXT
+0 text1.example.com. IN TXT 120 "k=rsa; p=one"
+Rcode: 0, RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='text1.example.com.', qtype=TXT
+0 text2.example.com. IN TXT 120 "k=rsa\\; p=one"
+Rcode: 0, RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='text2.example.com.', qtype=TXT
+0 text3.example.com. IN TXT 120 "k=rsa\\; p=one"
+Rcode: 0, RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='text3.example.com.', qtype=TXT
@@ -89,6 +89,11 @@ external-mail IN MX 25 server1.test.com.
text IN TXT "Hi, this is some text"
multitext IN TXT "text part one" "text part two" "text part three"
escapedtext IN TXT "begin" "the \"middle\" p\\art" "the end"
+text0 IN TXT "k=rsa; p=one"
+text1 IN TXT "k=rsa\; p=one"
+text2 IN TXT "k=rsa\\; p=one"
+text3 IN TXT "k=rsa\\\; p=one"
+
;
ipv6 IN AAAA 2001:6A8:0:1:210:4BFF:FE4B:4C61
;

0 comments on commit 3526186

Please sign in to comment.