]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
RRSIG wildcard labelcount
authorKees Monshouwer <mind04@monshouwer.org>
Tue, 2 Jun 2015 14:06:51 +0000 (16:06 +0200)
committermind04 <mind04@monshouwer.org>
Tue, 30 Jun 2015 06:12:45 +0000 (08:12 +0200)
pdns/dnsname.cc
pdns/dnsname.hh
pdns/dnssecsigner.cc

index 2c11810fc1528e19b2a890abef03c8125b7cec7c..329fa58de47ae3385a9ac6a824026bde02fbee97 100644 (file)
@@ -163,6 +163,14 @@ bool DNSName::chopOff()
   return true;
 }
 
+bool DNSName::isWildcard() const
+{
+  if(d_storage.empty())
+    return false;
+  auto p = d_storage.begin();
+  return (*p == 0x01 && *++p == '*');
+}
+
 unsigned int DNSName::countLabels() const
 {
   unsigned int count=0;
index a0e20c1b2099f5edec42b3f009c8a53d3d20405e..af243d33b56ff14eb5a5843b91c392bbba32660b 100644 (file)
@@ -41,6 +41,7 @@ public:
   void prependRawLabel(const std::string& str); //!< Prepend this unescaped label
   std::vector<std::string> getRawLabels() const; //!< Individual raw unescaped labels
   bool chopOff();                               //!< Turn www.powerdns.com. into powerdns.com., returns false for .
+  bool isWildcard() const;
   unsigned int countLabels() const;
   bool empty() const { return countLabels()==0; } // FIXME remove me?
   void clear() { trimToLabels(0); } // FIXME remove me?
index 0a3a0bb0b51ffd87956fa6fe5824229b9326edf0..b7eeb352e5776890b273ed4a82c52e33477252c4 100644 (file)
@@ -44,7 +44,7 @@ int getRRSIGsForRRSET(DNSSECKeeper& dk, const DNSName& signer, const DNSName sig
   RRSIGRecordContent rrc;
   rrc.d_type=signQType;
 
-  rrc.d_labels=signQName.countLabels()
+  rrc.d_labels=signQName.countLabels()-signQName.isWildcard();
   rrc.d_originalttl=signTTL; 
   rrc.d_siginception=startOfWeek - 7*86400; // XXX should come from zone metadata
   rrc.d_sigexpire=startOfWeek + 14*86400;