From: bert hubert Date: Wed, 12 Jun 2013 18:25:08 +0000 (+0200) Subject: enable us to do SRV records that end on . for zone2sql X-Git-Tag: rec-3.6.0-rc1~667 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9aa9781a0413f3ac2e38d495881e1b2d0f6891ae;p=thirdparty%2Fpdns.git enable us to do SRV records that end on . for zone2sql --- diff --git a/pdns/backends/bind/zone2sql.cc b/pdns/backends/bind/zone2sql.cc index a59b8de91c..0519697bc6 100644 --- a/pdns/backends/bind/zone2sql.cc +++ b/pdns/backends/bind/zone2sql.cc @@ -49,6 +49,20 @@ static dbmode_t g_mode; static bool g_intransaction; static int g_numRecords; + +/* this is an official wart. We don't terminate domains on a . in PowerDNS, + which is fine as it goes, except for encoding the root, it would end up as '', + which leads to ambiguities in the content field. Therefore, if we encounter + the root as a . in a BIND zone, we leave it as a ., and don't replace it by + an empty string. Back in 1999 we made the wrong choice. */ + +static string stripDotContent(const string& content) +{ + if(boost::ends_with(content, " .") || content==".") + return content; + return stripDot(content); +} + static string sqlstr(const string &name) { if(g_mode == SQLITE) @@ -149,7 +163,7 @@ static void emitRecord(const string& zoneName, const string &qname, const string cout<<"insert into records (domain_id, name,type,content,ttl,prio) select id ,"<< sqlstr(toLower(stripDot(qname)))<<", "<< sqlstr(qtype)<<", "<< - sqlstr(stripDot(content))<<", "<