]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
so, it turns out only the hashing/dnssec parts of powerdns need 'toDNSString()' lower...
authorbert hubert <bert.hubert@netherlabs.nl>
Thu, 10 Dec 2015 06:35:00 +0000 (07:35 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Thu, 10 Dec 2015 06:35:00 +0000 (07:35 +0100)
pdns/dnsname.cc
pdns/dnsname.hh
pdns/dnssecinfra.cc

index cfd38efa023c72ef345e70e25e97597408c4fd35..f2535a46cd165034897712f1474eecdc48ea7ea3 100644 (file)
@@ -115,9 +115,12 @@ std::string DNSName::toDNSString() const
   if (empty())
     throw std::out_of_range("Attempt to DNSString an unset dnsname");
 
-  string ret(d_storage.c_str(), d_storage.length());
-  return toLower(ret); // toLower or not toLower, that is the question
-  // return ret;
+  return std::string(d_storage.c_str(), d_storage.length());
+}
+
+std::string DNSName::toDNSStringLC() const
+{
+  return toLower(toDNSString()); // label lengths are always < 'A'
 }
 
 /**
index 3c1a2360bd933c6bf76b862322489b55ea6b75fe..5dbd6fc3e4295771eb7e90d1cbd8fef63b72f20c 100644 (file)
@@ -43,6 +43,7 @@ public:
   std::string toStringNoDot() const { return toString(".", false); }
   std::string toStringRootDot() const { if(isRoot()) return "."; else return toString(".", false); }
   std::string toDNSString() const;           //!< Our representation in DNS native format
+  std::string toDNSStringLC() const;           //!< Our representation in DNS native format, lower cased
   void appendRawLabel(const std::string& str); //!< Append this unescaped label
   void appendRawLabel(const char* start, unsigned int length); //!< Append this unescaped label
   void prependRawLabel(const std::string& str); //!< Prepend this unescaped label
index 2f30e3d832ee162fe5aa3df1fa529addbe52a122..357f20a0075e04735803432502e64ca498e16f5d 100644 (file)
@@ -310,7 +310,7 @@ string getMessageForRRSET(const DNSName& qname, const RRSIGRecordContent& rrc, v
   toHash.resize(toHash.size() - rrc.d_signature.length()); // chop off the end, don't sign the signature!
 
   for(shared_ptr<DNSRecordContent>& add :  signRecords) {
-    toHash.append(qname.toDNSString()); // FIXME400 tolower?
+    toHash.append(qname.toDNSStringLC()); 
     uint16_t tmp=htons(rrc.d_type);
     toHash.append((char*)&tmp, 2);
     tmp=htons(1); // class
@@ -329,7 +329,7 @@ string getMessageForRRSET(const DNSName& qname, const RRSIGRecordContent& rrc, v
 DSRecordContent makeDSFromDNSKey(const DNSName& qname, const DNSKEYRecordContent& drc, int digest)
 {
   string toHash;
-  toHash.assign(qname.toDNSString()); // FIXME400 tolower?
+  toHash.assign(qname.toDNSStringLC()); 
   toHash.append(const_cast<DNSKEYRecordContent&>(drc).serialize(DNSName(), true, true));
   
   DSRecordContent dsrc;
@@ -399,7 +399,7 @@ string hashQNameWithSalt(const NSEC3PARAMRecordContent& ns3prc, const DNSName& q
 {
   unsigned int times = ns3prc.d_iterations;
   unsigned char hash[20];
-  string toHash(qname.toDNSString());
+  string toHash(qname.toDNSStringLC());
 
   for(;;) {
     toHash.append(ns3prc.d_salt);