[Pdns-dev] tabulator escaping

Aki Tuomi cmouse at youzen.ext.b2.fi
Wed May 21 14:33:53 CEST 2014


On Wed, May 21, 2014 at 02:10:46PM +0200, Michal Babuska wrote:
> 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
>

Can you please make a pull request in github? 

Aki 



More information about the Pdns-dev mailing list