]> granicus.if.org Git - pdns/commitdiff
various DNSName() fixes
authorKees Monshouwer <mind04@monshouwer.org>
Sat, 7 Nov 2015 23:50:42 +0000 (00:50 +0100)
committermind04 <mind04@monshouwer.org>
Sun, 8 Nov 2015 10:00:29 +0000 (11:00 +0100)
pdns/backends/gsql/gsqlbackend.cc
pdns/dnsname.cc
pdns/dnssecsigner.cc

index 422275a603f4b2ffeb438966716014765a7815cf..ead7aff35519158f6e568d7408db5c586b08d5b5 100644 (file)
@@ -1588,7 +1588,6 @@ void GSQLBackend::extractRecord(const SSqlStatement::row_t& row, DNSResourceReco
     r.qname=d_qname;
   else
     r.qname=DNSName(row[6]);
-  if (r.qname.empty()) r.qname = DNSName(".");
 
   r.qtype=row[3];
 
index 464eec5ce86c152ed10b38880aaaac574dc215e8..7f7976e91e0d5044b3cee03a9a23dd2d52ad6e26 100644 (file)
@@ -86,12 +86,13 @@ std::string DNSName::toString(const std::string& separator, const bool trailing)
     throw std::out_of_range("Attempt to print an unset dnsname");
   }
 
+ if(isRoot())
+    return trailing ? separator : "";
+
   std::string ret;
   for(const auto& s : getRawLabels()) {
     ret+= escapeLabel(s) + separator;
   }
-  if(ret.empty())
-    return trailing ? separator : "";
 
   return ret.substr(0, ret.size()-!trailing);
 }
@@ -142,7 +143,7 @@ DNSName DNSName::makeRelative(const DNSName& zone) const
 {
   DNSName ret(*this);
   ret.makeUsRelative(zone);
-  return ret;
+  return ret.empty() ? zone : ret; // HACK FIXME400
 }
 void DNSName::makeUsRelative(const DNSName& zone) 
 {
@@ -232,7 +233,7 @@ bool DNSName::chopOff()
 
 bool DNSName::isWildcard() const
 {
-  if(d_storage.empty())
+  if(d_storage.size() < 2)
     return false;
   auto p = d_storage.begin();
   return (*p == 0x01 && *++p == '*');
index f8c22327a252d8d932506cf418932374354cc177..52beb9370e6e3d89be782779055c0ec00bd6e533 100644 (file)
@@ -225,6 +225,8 @@ void addRRSigs(DNSSECKeeper& dk, UeberBackend& db, const set<DNSName>& authSet,
     signQName= DNSName(toLower(pos->qname.toString()));
     if(!pos->wildcardname.empty())
       wildcardQName = DNSName(toLower(pos->wildcardname.toString()));
+    else
+      wildcardQName.clear();
     signQType = pos ->qtype.getCode();
     if(pos->signttl)
       signTTL = pos->signttl;