From: Kees Monshouwer Date: Tue, 2 Jun 2015 14:06:51 +0000 (+0200) Subject: RRSIG wildcard labelcount X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~58^2~21^2~5^2~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8aa5a28cd2376a19dc8c47b88fdafdfb4754f1ec;p=thirdparty%2Fpdns.git RRSIG wildcard labelcount --- diff --git a/pdns/dnsname.cc b/pdns/dnsname.cc index 2c11810fc1..329fa58de4 100644 --- a/pdns/dnsname.cc +++ b/pdns/dnsname.cc @@ -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; diff --git a/pdns/dnsname.hh b/pdns/dnsname.hh index a0e20c1b20..af243d33b5 100644 --- a/pdns/dnsname.hh +++ b/pdns/dnsname.hh @@ -41,6 +41,7 @@ public: void prependRawLabel(const std::string& str); //!< Prepend this unescaped label std::vector 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? diff --git a/pdns/dnssecsigner.cc b/pdns/dnssecsigner.cc index 0a3a0bb0b5..b7eeb352e5 100644 --- a/pdns/dnssecsigner.cc +++ b/pdns/dnssecsigner.cc @@ -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;