From: bert hubert Date: Wed, 18 Nov 2015 21:23:11 +0000 (+0100) Subject: make getTag() const on DNSKEYRecordContent. WARNING! This does entail an internal... X-Git-Tag: dnsdist-1.0.0-alpha1~187^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=523c312b66308393a78d728efb547e225a78e49b;p=pdns make getTag() const on DNSKEYRecordContent. WARNING! This does entail an internal copy since parts of what we use for getKey() are non-const. Should perhaps split up. Also add DNSKEYRecordContent ordering --- diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index 9c03ce64c..9d47361c3 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -476,9 +476,10 @@ boilerplate_conv(TKEY, QType::TKEY, ) TKEYRecordContent::TKEYRecordContent() { d_othersize = 0; } // fix CID#1288932 -uint16_t DNSKEYRecordContent::getTag() +uint16_t DNSKEYRecordContent::getTag() const { - string data=this->serialize(DNSName()); + DNSKEYRecordContent tmp(*this); + string data=tmp.serialize(DNSName()); // this can't be const for some reason const unsigned char* key=(const unsigned char*)data.c_str(); unsigned int keysize=data.length(); diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index c5b9bdd12..216274783 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -278,12 +278,17 @@ class DNSKEYRecordContent : public DNSRecordContent public: DNSKEYRecordContent(); includeboilerplate(DNSKEY) - uint16_t getTag(); + uint16_t getTag() const; uint16_t d_flags; uint8_t d_protocol; uint8_t d_algorithm; string d_key; + bool operator<(const DNSKEYRecordContent& rhs) const + { + return tie(d_flags, d_protocol, d_algorithm, d_key) < + tie(rhs.d_flags, rhs.d_protocol, rhs.d_algorithm, rhs.d_key); + } }; class CDNSKEYRecordContent : public DNSRecordContent