]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
make additional lookups smarter about trailing dots. make pdnssec error about trailin...
authorPeter van Dijk <peter.van.dijk@netherlabs.nl>
Thu, 4 Oct 2012 07:09:11 +0000 (07:09 +0000)
committerPeter van Dijk <peter.van.dijk@netherlabs.nl>
Thu, 4 Oct 2012 07:09:11 +0000 (07:09 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2748 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/packethandler.cc
pdns/pdnssec.cc
pdns/slavecommunicator.cc

index 1986dbf15ac3a8d77d1243f05528237d84ce2984..25fe564749287d0347f523387ce1a54bbd134d4b 100644 (file)
@@ -362,15 +362,11 @@ int PacketHandler::doAdditionalProcessingAndDropAA(DNSPacket *p, DNSPacket *r, c
 
     vector<DNSResourceRecord> crrs;
 
-    for(vector<DNSResourceRecord *>::const_iterator i=arrs.begin();
-        i!=arrs.end(); ++i) 
+    for(vector<DNSResourceRecord *>::const_iterator i=arrs.begin(); i!=arrs.end(); ++i) 
       crrs.push_back(**i);
 
     // we now have a copy, push_back on packet might reallocate!
-    for(vector<DNSResourceRecord>::const_iterator i=crrs.begin();
-        i!=crrs.end();
-        ++i) {
-      
+    for(vector<DNSResourceRecord>::const_iterator i=crrs.begin(); i!=crrs.end(); ++i) {
       if(r->d.aa && !i->qname.empty() && i->qtype.getCode()==QType::NS && !B.getSOA(i->qname,sd,p)) { // drop AA in case of non-SOA-level NS answer, except for root referral
         r->setA(false);
         //     i->d_place=DNSResourceRecord::AUTHORITY; // XXX FIXME
index 3f4a7fc1af917bd919c066dbc4286435c41e3bd5..fea7d569400ae583c996761b8ccb1b00ce10c1e7 100644 (file)
@@ -270,7 +270,7 @@ int checkZone(DNSSECKeeper& dk, const std::string& zone)
   } 
   sd.db->list(zone, sd.domain_id);
   DNSResourceRecord rr;
-  uint64_t numrecords=0, numerrors=0;
+  uint64_t numrecords=0, numerrors=0, numwarnings=0;
   
   while(sd.db->get(rr)) {
     if(!rr.qtype.getCode())
@@ -283,20 +283,32 @@ int checkZone(DNSSECKeeper& dk, const std::string& zone)
     }
     
     if(rr.qtype.getCode() == QType::URL || rr.qtype.getCode() == QType::MBOXFW) {
-      cout<<"The recordtype "<<rr.qtype.getName()<<" for record '"<<rr.qname<<"' is no longer supported."<<endl;
+      cout<<"[Error] The recordtype "<<rr.qtype.getName()<<" for record '"<<rr.qname<<"' is no longer supported."<<endl;
       numerrors++;
       continue;
     }
       
+    if (rr.qname[rr.qname.size()-1] == '.') {
+      cout<<"[Error] Record '"<<rr.qname<<"' has a trailing dot. PowerDNS will ignore this record!"<<endl;
+      numerrors++;
+    }
+
+      
     if(rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::SRV) 
       rr.content = lexical_cast<string>(rr.priority)+" "+rr.content;
 
+    if ( (rr.qtype.getCode() == QType::NS || rr.qtype.getCode() == QType::SRV || rr.qtype.getCode() == QType::MX) &&
+         rr.content[rr.content.size()-1] == '.') {
+      cout<<"[Warning] The record "<<rr.qname<<" with type "<<rr.qtype.getName()<<" has a trailing dot in the content ("<<rr.content<<"). Your backend might not work well with this."<<endl;
+      numwarnings++;
+    }
+
     if(rr.qtype.getCode() == QType::TXT && !rr.content.empty() && rr.content[0]!='"')
       rr.content = "\""+rr.content+"\"";  
       
     if(rr.auth == 0 && rr.qtype.getCode()!=QType::NS && rr.qtype.getCode()!=QType::A && rr.qtype.getCode()!=QType::AAAA)
     {
-      cout<<"Following record is auth=0, run pdnssec rectify-zone?: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " " << rr.content<<endl;
+      cout<<"[Error] Following record is auth=0, run pdnssec rectify-zone?: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " " << rr.content<<endl;
       numerrors++;
     }
     try {
@@ -305,13 +317,13 @@ int checkZone(DNSSECKeeper& dk, const std::string& zone)
     }
     catch(std::exception& e) 
     {
-      cout<<"Following record had a problem: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " " << rr.content<<endl;
-      cout<<"Error was: "<<e.what()<<endl;
+      cout<<"[Error] Following record had a problem: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " " << rr.content<<endl;
+      cout<<"[Error] Error was: "<<e.what()<<endl;
       numerrors++;
     }
     numrecords++;
   }
-  cout<<"Checked "<<numrecords<<" records of '"<<zone<<"', "<<numerrors<<" errors"<<endl;
+  cout<<"Checked "<<numrecords<<" records of '"<<zone<<"', "<<numerrors<<" errors, "<<numwarnings<<" warnings."<<endl;
   return numerrors;
 }
 
index eb4324fc527033c99f7d8533a93f064e0904b83c..aae39516a2d58a1164311b067d806d13b4be696f 100644 (file)
@@ -158,8 +158,8 @@ void CommunicatorClass::suck(const string &domain,const string &remote)
         return;
       }
     } else {
-               laddr.sin4.sin_family = 0;
-       }
+                 laddr.sin4.sin_family = 0;
+    }
 
     AXFRRetriever retriever(raddr, domain.c_str(), tsigkeyname, tsigalgorithm, tsigsecret,
                (laddr.sin4.sin_family == 0) ? NULL : &laddr);
@@ -208,6 +208,8 @@ void CommunicatorClass::suck(const string &domain,const string &remote)
         }
         
         i->domain_id=domain_id;
+        if (i->qtype.getCode() == QType::SRV)
+          i->content = stripDot(i->content);
 #if 0
         if(i->qtype.getCode()>=60000)
           throw DBException("Database can't store unknown record type "+lexical_cast<string>(i->qtype.getCode()-1024));