[Pdns-dev] tabulator escaping

Michal Babuska michal at neotronic.org
Wed May 21 14:10:46 CEST 2014


Hi, 

i think I've found a bug in latest pdns from git. 

I use pdns as a slave to a bind9 server. I have several zones with txt records, which contain among other characters some tabulators. When pdns writes the zone on disc, all the tabs are replaced with string "\009". I believe this should not happen.

I've tracked the problem to pdns/dnsparser.cc in function static string txtEscape(const string &name) where the escaping happens.

I've solved it for my self this way:

diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc
index b0030fd..a81182d 100644
--- a/pdns/dnsparser.cc
+++ b/pdns/dnsparser.cc
@@ -413,7 +413,7 @@ static string txtEscape(const string &name)
   char ebuf[5];
 
   for(string::const_iterator i=name.begin();i!=name.end();++i) {
-    if((unsigned char) *i > 127 || (unsigned char) *i < 32) {
+    if(((unsigned char) *i > 127 || (unsigned char) *i < 32) && (unsigned char) *i != 9) { // hey teacher, leave the tabs alone
       snprintf(ebuf, sizeof(ebuf), "\\%03u", (unsigned char)*i);
       ret += ebuf;
     }



Regards,
Michal Babuska



More information about the Pdns-dev mailing list