]> granicus.if.org Git - pdns/commitdiff
further round of DNSName cleanup. Found more cases where we were round-tripping DNSNa...
authorbert hubert <bert.hubert@netherlabs.nl>
Sun, 27 Sep 2015 18:58:29 +0000 (20:58 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Sun, 27 Sep 2015 18:58:29 +0000 (20:58 +0200)
modules/bindbackend/bindbackend2.cc
modules/pipebackend/pipebackend.cc
pdns/pdnssec.cc
pdns/zone2json.cc
pdns/zone2ldap.cc
pdns/zone2sql.cc

index 80536026f1f338287275e8041169edbda7154f5c..c4baaced3480d3aef85159df2d487c004f2acb85 100644 (file)
@@ -507,7 +507,7 @@ string Bind2Backend::DLReloadNowHandler(const vector<string>&parts, Utility::pid
 
   for(vector<string>::const_iterator i=parts.begin()+1;i<parts.end();++i) {
     BB2DomainInfo bbd;
-    if(safeGetBBDomainInfo(*i, &bbd)) {
+    if(safeGetBBDomainInfo(DNSName(*i), &bbd)) {
       Bind2Backend bb2;
       bb2.queueReloadAndStore(bbd.d_id);
       ret<< *i << ": "<< (bbd.d_loaded ? "": "[rejected]") <<"\t"<<bbd.d_status<<"\n";      
@@ -528,7 +528,7 @@ string Bind2Backend::DLDomStatusHandler(const vector<string>&parts, Utility::pid
   if(parts.size() > 1) {
     for(vector<string>::const_iterator i=parts.begin()+1;i<parts.end();++i) {
       BB2DomainInfo bbd;
-      if(safeGetBBDomainInfo(*i, &bbd)) {      
+      if(safeGetBBDomainInfo(DNSName(*i), &bbd)) {     
         ret<< *i << ": "<< (bbd.d_loaded ? "": "[rejected]") <<"\t"<<bbd.d_status<<"\n";
     }
       else
@@ -724,7 +724,7 @@ void Bind2Backend::doEmptyNonTerminals(BB2DomainInfo& bbd, bool nsec3zone, NSEC3
   {
     rr.qname=nt.first+bbd.d_name;
     if(nsec3zone)
-      hashed=toBase32Hex(hashQNameWithSalt(ns3pr, rr.qname.toString()));
+      hashed=toBase32Hex(hashQNameWithSalt(ns3pr, rr.qname));
     insertRecord(bbd, rr.qname, rr.qtype, rr.content, rr.ttl, hashed, &nt.second);
   }
 }
index 81f651faafeff9e97b7cfa7c33d0457b320d606c..deb55cc4ab2cbae2a02a69912ac20b6e5d13791e 100644 (file)
@@ -169,7 +169,7 @@ bool PipeBackend::list(const DNSName& target, int inZoneId, bool include_disable
       L<<Logger::Error<<kBackendId<<" Error from coprocess: "<<ae.reason<<endl;
       throw;
    }
-   d_qname=itoa(inZoneId);
+   d_qname=DNSName(itoa(inZoneId)); // why do we store a number here??
    return true;
 }
 
@@ -262,7 +262,7 @@ bool PipeBackend::get(DNSResourceRecord &r)
            r.scopeMask = 0;
            r.auth = 1;
          }
-         r.qname=parts[1+extraFields];
+         r.qname=DNSName(parts[1+extraFields]);
          r.qtype=parts[3+extraFields];
          r.ttl=atoi(parts[4+extraFields].c_str());
          r.domain_id=atoi(parts[5+extraFields].c_str());
index 758ef2d28a3d8fb17b1dac362fb7fcd97e6c984d..f006cf5e013242598ba1630fd1032e9e71f27535 100644 (file)
@@ -238,7 +238,7 @@ bool rectifyZone(DNSSECKeeper& dk, const DNSName& zone)
     cerr<<"Non DNSSEC zone, only adding empty non-terminals"<<endl;
 
   if(doTransaction)
-    sd.db->startTransaction("", -1);
+    sd.db->startTransaction(DNSName(""), -1);
 
   bool realrr=true;
   uint32_t maxent = ::arg().asNum("max-ent-entries");
@@ -369,12 +369,12 @@ void dbBench(const std::string& fname)
   dt.set();
   unsigned int hits=0, misses=0;
   for(; n < 10000; ++n) {
-    const string& domain = domains[random() % domains.size()];
+    DNSName domain(domains[random() % domains.size()]);
     B.lookup(QType(QType::NS), domain);
     while(B.get(rr)) {
       hits++;
     }
-    B.lookup(QType(QType::A), boost::lexical_cast<string>(random())+"."+domain);
+    B.lookup(QType(QType::A), DNSName(boost::lexical_cast<string>(random()))+domain);
     while(B.get(rr)) {
     }
     misses++;
@@ -546,9 +546,9 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone)
         cout<<"[Warning] DNSKEY record not at apex '"<<rr.qname.toString()<<" IN "<<rr.qtype.getName()<<" "<<rr.content<<"' in zone '"<<zone.toString()<<"', should not be here."<<endl;
         numwarnings++;
       } else if (rr.qtype.getCode() == QType::NS && DNSName(rr.content).isPartOf(rr.qname)) {
-        checkglue.insert(toLower(rr.content));
+        checkglue.insert(DNSName(toLower(rr.content)));
       } else if (rr.qtype.getCode() == QType::A || rr.qtype.getCode() == QType::AAAA) {
-        glue.insert(toLower(rr.qname.toString()));
+        glue.insert(rr.qname);
       }
     }
 
@@ -727,7 +727,7 @@ int increaseSerial(const DNSName& zone, DNSSECKeeper &dk)
   }
   rrs[0].content = serializeSOAData(sd);
 
-  sd.db->startTransaction("", -1);
+  sd.db->startTransaction(DNSName(), -1);
 
   if (! sd.db->replaceRRSet(sd.domain_id, zone, rr.qtype, rrs)) {
    sd.db->abortTransaction();
@@ -893,10 +893,10 @@ bool testAlgorithms()
   return DNSCryptoKeyEngine::testAll();
 }
 
-void testSpeed(DNSSECKeeper& dk, const string& zone, const string& remote, int cores)
+void testSpeed(DNSSECKeeper& dk, const DNSName& zone, const string& remote, int cores)
 {
   DNSResourceRecord rr;
-  rr.qname="blah."+zone;
+  rr.qname=DNSName("blah")+zone;
   rr.qtype=QType::A;
   rr.ttl=3600;
   rr.auth=1;
@@ -910,7 +910,7 @@ void testSpeed(DNSSECKeeper& dk, const string& zone, const string& remote, int c
     throw runtime_error("No backends available for DNSSEC key storage");
   }
 
-  ChunkedSigningPipe csp(zone, 1, remote, cores);
+  ChunkedSigningPipe csp(DNSName(zone), 1, remote, cores);
   
   vector<DNSResourceRecord> signatures;
   uint32_t rnd;
@@ -925,7 +925,7 @@ void testSpeed(DNSSECKeeper& dk, const string& zone, const string& remote, int c
     rr.content=tmp;
     
     snprintf(tmp, sizeof(tmp), "r-%u", rnd);
-    rr.qname=string(tmp)+"."+zone;
+    rr.qname=DNSName(tmp)+zone;
     
     if(csp.submit(rr))
       while(signatures = csp.getChunk(), !signatures.empty())
@@ -1251,11 +1251,11 @@ void testSchema(DNSSECKeeper& dk, const DNSName& zone)
   db->feedRecord(rr);
 
   rr.qtype=QType::A;
-  rr.qname="_underscore."+zone;
+  rr.qname=DNSName("_underscore")+zone;
   rr.content="127.0.0.1";
   db->feedRecord(rr);
 
-  rr.qname="bla."+zone;
+  rr.qname=DNSName("bla")+zone;
   cout<<"Committing"<<endl;
   db->commitTransaction();
 
@@ -1265,9 +1265,9 @@ void testSchema(DNSSECKeeper& dk, const DNSName& zone)
   rectifyZone(dk, zone);
   cout<<"Checking underscore ordering"<<endl;
   DNSName before, after;
-  db->getBeforeAndAfterNames(di.id, zone, "z."+zone, before, after);
+  db->getBeforeAndAfterNames(di.id, zone, DNSName("z")+zone, before, after);
   cout<<"got '"<<before.toString()<<"' < 'z."<<zone.toString()<<"' < '"<<after.toString()<<"'"<<endl;
-  if(before != "_underscore."+zone)
+  if(before != DNSName("_underscore")+zone)
   {
     cout<<"before is wrong, got '"<<before.toString()<<"', expected '_underscore."<<zone.toString()<<"', aborting"<<endl;
     return;
@@ -1430,7 +1430,7 @@ try
       cerr << "Syntax: pdnssec test-schema ZONE"<<endl;
       return 0;
     }
-    testSchema(dk, cmds[1]);
+    testSchema(dk, DNSName(cmds[1]));
     return 0;
   }
   if(cmds[0] == "rectify-zone") {
@@ -1440,7 +1440,8 @@ try
     }
     unsigned int exitCode = 0;
     for(unsigned int n = 1; n < cmds.size(); ++n) 
-      if (!rectifyZone(dk, cmds[n])) exitCode = 1;
+      if (!rectifyZone(dk, DNSName(cmds[n]))) 
+       exitCode = 1;
     return exitCode;
   }
   else if (cmds[0] == "rectify-all-zones") {
@@ -1452,7 +1453,7 @@ try
       return 0;
     }
     UeberBackend B("default");
-    exit(checkZone(dk, B, cmds[1]));
+    exit(checkZone(dk, B, DNSName(cmds[1])));
   }
   else if(cmds[0] == "bench-db") {
     dbBench(cmds.size() > 1 ? cmds[1] : "");
@@ -1493,7 +1494,7 @@ try
       cerr << "Syntax: pdnssec test-speed numcores [signing-server]"<<endl;
       return 0;
     }
-    testSpeed(dk, cmds[1],  (cmds.size() > 3) ? cmds[3] : "", atoi(cmds[2].c_str()));
+    testSpeed(dk, DNSName(cmds[1]),  (cmds.size() > 3) ? cmds[3] : "", atoi(cmds[2].c_str()));
   }
   else if(cmds[0] == "verify-crypto") {
     if(cmds.size() != 2) {
@@ -1508,15 +1509,14 @@ try
       cerr << "Syntax: pdnssec show-zone ZONE"<<endl;
       return 0;
     }
-    const string& zone=cmds[1];
-    if (!showZone(dk, zone)) return 1;
+    if (!showZone(dk, DNSName(cmds[1]))) return 1;
   }
   else if(cmds[0] == "disable-dnssec") {
     if(cmds.size() != 2) {
       cerr << "Syntax: pdnssec disable-dnssec ZONE"<<endl;
       return 0;
     }
-    const string& zone=cmds[1];
+    DNSName zone(cmds[1]);
     if(!disableDNSSECOnZone(dk, zone)) {
       cerr << "Cannot disable DNSSEC on " << zone << endl;
       return 1;
@@ -1527,7 +1527,7 @@ try
       cerr << "Syntax: pdnssec activate-zone-key ZONE KEY-ID"<<endl;
       return 0;
     }
-    const string& zone=cmds[1];
+    DNSName zone(cmds[1]);
     unsigned int id=atoi(cmds[2].c_str());
     if(!id)
     {
@@ -1545,7 +1545,7 @@ try
       cerr << "Syntax: pdnssec deactivate-zone-key ZONE KEY-ID"<<endl;
       return 0;
     }
-    const string& zone=cmds[1];
+    DNSName zone(cmds[1]);
     unsigned int id=atoi(cmds[2].c_str());
     if(!id)
     {
@@ -1563,7 +1563,7 @@ try
       cerr << "Syntax: pdnssec add-zone-key ZONE zsk|ksk [bits] [rsasha1|rsasha256|rsasha512|gost|ecdsa256|ecdsa384]"<<endl;
       return 0;
     }
-    const string& zone=cmds[1];
+    DNSName zone(cmds[1]);
 
     UeberBackend B("default");
     DomainInfo di;
@@ -1612,7 +1612,7 @@ try
       cerr<<"Syntax: pdnssec remove-zone-key ZONE KEY-ID"<<endl;
       return 0;
     }
-    const string& zone=cmds[1];
+    DNSName zone(cmds[1]);
     unsigned int id=atoi(cmds[2].c_str());
     if (!dk.removeKey(zone, id)) {
        cerr<<"Cannot remove key " << id << " from " << zone <<endl;
@@ -1625,14 +1625,14 @@ try
       cerr<<"Syntax: pdnssec delete-zone ZONE"<<endl;
       return 0;
     }
-    exit(deleteZone(cmds[1]));
+    exit(deleteZone(DNSName(cmds[1])));
   }
   else if(cmds[0] == "create-zone") {
     if(cmds.size() != 2) {
       cerr<<"Syntax: pdnssec create-zone ZONE"<<endl;
       return 0;
     }
-    exit(createZone(cmds[1]));
+    exit(createZone(DNSName(cmds[1])));
   }
   else if(cmds[0] == "list-zone") {
     if(cmds.size() != 2) {
@@ -1642,7 +1642,7 @@ try
     if(cmds[1]==".")
       cmds[1].clear();
 
-    exit(listZone(cmds[1]));
+    exit(listZone(DNSName(cmds[1])));
   }
   else if(cmds[0] == "load-zone") {
     if(cmds.size() != 3) {
@@ -1652,18 +1652,18 @@ try
     if(cmds[1]==".")
       cmds[1].clear();
 
-    exit(loadZone(cmds[1], cmds[2]));
+    exit(loadZone(DNSName(cmds[1]), cmds[2]));
   }
   else if(cmds[0] == "secure-zone") {
     if(cmds.size() < 2) {
       cerr << "Syntax: pdnssec secure-zone ZONE"<<endl;
       return 0;
     }
-    vector<string> mustRectify;
+    vector<DNSName> mustRectify;
     dk.startTransaction();    
     unsigned int zoneErrors=0;
     for(unsigned int n = 1; n < cmds.size(); ++n) {
-      const string& zone=cmds[n];
+      DNSName zone(cmds[n]);
       if(secureZone(dk, zone)) {
         mustRectify.push_back(zone);
       } else {
@@ -1672,7 +1672,7 @@ try
     }
     
     dk.commitTransaction();
-    BOOST_FOREACH(string& zone, mustRectify)
+    for(const auto& zone : mustRectify)
       rectifyZone(dk, zone);
 
     if (zoneErrors) {
@@ -1746,7 +1746,7 @@ try
       cerr<<"Syntax: pdnssec set-presigned ZONE"<<endl;
       return 0; 
     }
-    if (! dk.setPresigned(cmds[1])) {
+    if (! dk.setPresigned(DNSName(cmds[1]))) {
       cerr << "Could not set presigned on for " << cmds[1] << endl;
       return 1;
     }
@@ -1757,7 +1757,7 @@ try
       cerr<<"Syntax: pdnssec unset-presigned ZONE"<<endl;
       return 0;  
     }
-    if (! dk.unsetPresigned(cmds[1])) {
+    if (! dk.unsetPresigned(DNSName(cmds[1]))) {
       cerr << "Could not unset presigned on for " << cmds[1] << endl;
       return 1;
     }
@@ -1769,7 +1769,7 @@ try
       return 0;
     }
     DNSName zone(cmds[1]);
-    string& record=cmds[2];
+    DNSName record(cmds[2]);
     NSEC3PARAMRecordContent ns3pr;
     bool narrow;
     if(!dk.getNSEC3PARAM(zone, &ns3pr, &narrow)) {
@@ -1787,7 +1787,7 @@ try
       cerr<<"Syntax: pdnssec unset-nsec3 ZONE"<<endl;
       return 0;
     }
-    if ( ! dk.unsetNSEC3PARAM(cmds[1])) {
+    if ( ! dk.unsetNSEC3PARAM(DNSName(cmds[1]))) {
       cerr<<"Cannot unset NSEC3 param for " << cmds[1] << endl;
       return 1;
     }
@@ -1801,7 +1801,7 @@ try
 
     string zone=cmds[1];
     unsigned int id=atoi(cmds[2].c_str());
-    DNSSECPrivateKey dpk=dk.getKeyById(zone, id);
+    DNSSECPrivateKey dpk=dk.getKeyById(DNSName(zone), id);
     cout << dpk.getKey()->convertToISC() <<endl;
   }  
   else if(cmds[0]=="increase-serial") {
@@ -1809,7 +1809,7 @@ try
       cerr<<"Syntax: pdnssec increase-serial ZONE"<<endl;
       return 0;
     }
-    return increaseSerial(cmds[1], dk);
+    return increaseSerial(DNSName(cmds[1]), dk);
   }
   else if(cmds[0]=="import-zone-key-pem") {
     if(cmds.size() < 4) {
@@ -1853,7 +1853,7 @@ try
     else
       dpk.d_flags = 257; // ksk
       
-    if(!dk.addKey(zone, dpk)) {
+    if(!dk.addKey(DNSName(zone), dpk)) {
       cerr<<"Adding key failed, perhaps DNSSEC not enabled in configuration?"<<endl;
       exit(1);
     }
@@ -1892,7 +1892,7 @@ try
         exit(1);
       }          
     }
-    if(!dk.addKey(zone, dpk, active)) {
+    if(!dk.addKey(DNSName(zone), dpk, active)) {
       cerr<<"Adding key failed, perhaps DNSSEC not enabled in configuration?"<<endl;
       exit(1);
     }
@@ -1903,7 +1903,7 @@ try
       exit(1);
     }
 
-    string zone=cmds[1];
+    DNSName zone(cmds[1]);
     unsigned int id=atoi(cmds[2].c_str());
     DNSSECPrivateKey dpk=dk.getKeyById(zone, id);
     cout << zone<<" IN DNSKEY "<<dpk.getDNSKEY().getZoneRepresentation() <<endl;
@@ -1968,7 +1968,7 @@ try
         cerr << "Syntax: " << cmds[0] << " name (hmac-md5|hmac-sha1|hmac-sha224|hmac-sha256|hmac-sha384|hmac-sha512)" << endl;
         return 0;
      }
-     string name = cmds[1];
+     DNSName name(cmds[1]);
      string algo = cmds[2];
      string key;
      char tmpkey[64];
@@ -1999,7 +1999,7 @@ try
      key = Base64Encode(std::string(tmpkey, klen));
 
      UeberBackend B("default");
-     if (B.setTSIGKey(name, algo, key)) {
+     if (B.setTSIGKey(name, DNSName(algo), key)) { // you are feeling bored, put up DNSName(algo) up earlier
        cout << "Create new TSIG key " << name << " " << algo << " " << key << endl;
      } else {
        cout << "Failure storing new TSIG key " << name << " " << algo << " " << key << endl;
@@ -2011,12 +2011,12 @@ try
         cerr << "Syntax: " << cmds[0] << " name algorithm key" << endl;
         return 0;
      }
-     string name = cmds[1];
+     DNSName name(cmds[1]);
      string algo = cmds[2];
      string key = cmds[3];
 
      UeberBackend B("default");
-     if (B.setTSIGKey(name, algo, key)) {
+     if (B.setTSIGKey(name, DNSName(algo), key)) {
        cout << "Imported TSIG key " << name << " " << algo << endl;
      } else {
        cout << "Failure importing TSIG key " << name << " " << algo << endl;
@@ -2028,7 +2028,7 @@ try
         cerr << "Syntax: " << cmds[0] << " name" << endl;
         return 0;
      }
-     string name = cmds[1];
+     DNSName name(cmds[1]);
 
      UeberBackend B("default");
      if (B.deleteTSIGKey(name)) {
@@ -2053,7 +2053,7 @@ try
         cerr << "Syntax: " << cmds[0] << " zone name [master|slave]" << endl;
         return 0;
      }
-     string zname = cmds[1];
+     DNSName zname(cmds[1]);
      string name = cmds[2];
      if (cmds[3] == "master")
         metaKey = "TSIG-ALLOW-AXFR";
@@ -2087,7 +2087,7 @@ try
         cerr << "Syntax: " << cmds[0] << " zone name [master|slave]" << endl;
         return 0;
      }
-     string zname = cmds[1];
+     DNSName zname(cmds[1]);
      string name = cmds[2];
      if (cmds[3] == "master")
         metaKey = "TSIG-ALLOW-AXFR";
@@ -2120,7 +2120,7 @@ try
        cerr << "Syntax: " << cmds[0] << " zone [kind kind ..]" << endl;
        return 1;
     }
-    string zone = cmds[1];
+    DNSName zone(cmds[1]);
     vector<string> keys;
     DomainInfo di;
 
@@ -2155,7 +2155,7 @@ try
        cerr << "Syntax: " << cmds[0] << " zone kind [value value ..]" << endl;
        return 1;
     }
-    string zone = cmds[1];
+    DNSName zone(cmds[1]);
     string kind = cmds[2];
     vector<string> meta(cmds.begin() + 3, cmds.end());
 
index af3a4504f7a516578d3b6e588d164219b0f8e5a6..8b2e814994a3a7b2dc36c8b678c9cd2faa8662ff 100644 (file)
@@ -173,7 +173,7 @@ try
             obj["name"] = i->name.toStringNoDot();
 
             while(zpt.get(rr)) 
-              recs.push_back(emitRecord(i->name.toStringNoDot(), rr.qname.toStringNoDot(), rr.qtype.getName(), rr.content, rr.ttl));
+              recs.push_back(emitRecord(i->name.toStringNoDot(), rr.qname, rr.qtype.getName(), rr.content, rr.ttl));
             obj["records"] = recs;
             Json tmp = obj;
             cout<<tmp.dump();
@@ -199,7 +199,7 @@ try
       cerr<<"\r100% done\033\133\113"<<endl;
     }
     else {
-      ZoneParserTNG zpt(zonefile, ::arg()["zone-name"]);
+      ZoneParserTNG zpt(zonefile, DNSName(::arg()["zone-name"]));
       DNSResourceRecord rr;
       string zname;
       Json::object obj;
@@ -208,7 +208,7 @@ try
       obj["name"] = ::arg()["zone-name"];
 
       while(zpt.get(rr)) 
-        records.push_back(emitRecord(::arg()["zone-name"], rr.qname.toStringNoDot(), rr.qtype.getName(), rr.content, rr.ttl));
+        records.push_back(emitRecord(::arg()["zone-name"], rr.qname, rr.qtype.getName(), rr.content, rr.ttl));
       obj["records"] = records;
 
       Json tmp = obj;
index 33bf730ae4df978046ded019c37d184731766de7..bf8dccdbe334d611a84eb08e7345b22a8c42860f 100644 (file)
@@ -201,7 +201,7 @@ int main( int argc, char* argv[] )
                                         }
                                 try
                                 {
-                                        if( i->name != "." && i->name != "localhost" && i->name != "0.0.127.in-addr.arpa" )
+                                 if( i->name != DNSName(".") && i->name != DNSName("localhost") && i->name != DNSName("0.0.127.in-addr.arpa") )
                                         {
                                                 cerr << "Parsing file: " << i->filename << ", domain: " << i->name.toString() << endl;
                                                 g_zonename = i->name;
@@ -229,8 +229,8 @@ int main( int argc, char* argv[] )
                                         return 1;
                         }
 
-                        g_zonename = args["zone-name"];
-                        ZoneParserTNG zpt(args["zone-file"], args["zone-name"]);
+                        g_zonename = DNSName(args["zone-name"]);
+                        ZoneParserTNG zpt(args["zone-file"], g_zonename);
                         DNSResourceRecord rr;
                         while(zpt.get(rr))
                                 callback(0, rr.qname, rr.qtype.getName(), rr.content, rr.ttl);
index 9f6b6ab9db36af11d87e7f13d6d5a5da81dc5de2..512a953c52564999ea0f996f0740609507de90c7 100644 (file)
@@ -407,7 +407,7 @@ try
               if(rr.qtype.getCode() == QType::SOA)
                 seenSOA=true;
 
-              emitRecord(i->name.toStringNoDot(), rr.qname.toStringNoDot(), rr.qtype.getName(), rr.content, rr.ttl, comment);
+              emitRecord(i->name.toStringNoDot(), rr.qname, rr.qtype.getName(), rr.content, rr.ttl, comment);
             }
             num_domainsdone++;
           }
@@ -431,11 +431,11 @@ try
       cerr<<"\r100% done\033\133\113"<<endl;
     }
     else {
-      string zonename = ::arg()["zone-name"];
+      DNSName zonename(::arg()["zone-name"]);
       ZoneParserTNG zpt(zonefile, zonename);
       DNSResourceRecord rr;
       startNewTransaction();
-      emitDomain(zonename);
+      emitDomain(zonename.toStringNoDot());
       string comment;
       bool seenSOA=false;
       while(zpt.get(rr, &comment))  {
@@ -444,7 +444,7 @@ try
        if(rr.qtype.getCode() == QType::SOA)
          seenSOA=true;
 
-        emitRecord(zonename, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, comment);
+        emitRecord(zonename.toStringNoDot(), rr.qname, rr.qtype.getName(), rr.content, rr.ttl, comment);
       }
       num_domainsdone=1;
     }