]> granicus.if.org Git - pdns/commitdiff
fix a few empty DNSName issues
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 6 Nov 2015 21:01:48 +0000 (22:01 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 6 Nov 2015 21:01:48 +0000 (22:01 +0100)
pdns/dnsname.cc
pdns/dnssecsigner.cc
pdns/packethandler.cc

index c9488d4bff460c1382c358f118b5c7ed3bf8cbb0..ebc8598a3e1f6af0a294987062ff158650821f74 100644 (file)
@@ -82,8 +82,9 @@ void DNSName::packetParser(const char* qpos, int len, int offset, bool uncompres
 
 std::string DNSName::toString(const std::string& separator, const bool trailing) const
 {
-  if (empty())
+  if (empty()) {
     throw std::out_of_range("Attempt to print an unset dnsname");
+  }
 
   std::string ret;
   for(const auto& s : getRawLabels()) {
@@ -156,6 +157,8 @@ void DNSName::makeUsRelative(const DNSName& zone)
 DNSName DNSName::labelReverse() const
 {
   DNSName ret;
+  if(isRoot())
+    return *this; // we don't create the root automatically below
   if (!empty()) {
     vector<string> l=getRawLabels();
     while(!l.empty()) {
index 61db72998f5f0d6003333235444e70232bd89c77..f8c22327a252d8d932506cf418932374354cc177 100644 (file)
@@ -223,7 +223,8 @@ void addRRSigs(DNSSECKeeper& dk, UeberBackend& db, const set<DNSName>& authSet,
     }
     signedRecords.push_back(*pos);
     signQName= DNSName(toLower(pos->qname.toString()));
-    wildcardQName = DNSName(toLower(pos->wildcardname.toString()));
+    if(!pos->wildcardname.empty())
+      wildcardQName = DNSName(toLower(pos->wildcardname.toString()));
     signQType = pos ->qtype.getCode();
     if(pos->signttl)
       signTTL = pos->signttl;
index 2ed23adc206c35cc250cc7f7abdea716f1980f39..2449ced083602da0a1ee6046c3e20212d9584175 100644 (file)
@@ -104,6 +104,7 @@ void PacketHandler::addRootReferral(DNSPacket* r)
 
   // add . NS records
   DNSResourceRecord rr;
+  rr.qname = DNSName(".");
   rr.qtype=QType::NS;
   rr.ttl=518400;
   rr.d_place=DNSResourceRecord::AUTHORITY;