tabulator escaping

Michal Babuska <[email protected]>
Newsgroups gmane.network.dns.powerdns.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.