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'
}
/**
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
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
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;
{
unsigned int times = ns3prc.d_iterations;
unsigned char hash[20];
- string toHash(qname.toDNSString());
+ string toHash(qname.toDNSStringLC());
for(;;) {
toHash.append(ns3prc.d_salt);