std::string DNSName::toString(const std::string& separator, const bool trailing) const
{
- if (empty())
+ if (empty()) {
throw std::out_of_range("Attempt to print an unset dnsname");
+ }
std::string ret;
for(const auto& s : getRawLabels()) {
DNSName DNSName::labelReverse() const
{
DNSName ret;
+ if(isRoot())
+ return *this; // we don't create the root automatically below
if (!empty()) {
vector<string> l=getRawLabels();
while(!l.empty()) {
}
signedRecords.push_back(*pos);
signQName= DNSName(toLower(pos->qname.toString()));
- wildcardQName = DNSName(toLower(pos->wildcardname.toString()));
+ if(!pos->wildcardname.empty())
+ wildcardQName = DNSName(toLower(pos->wildcardname.toString()));
signQType = pos ->qtype.getCode();
if(pos->signttl)
signTTL = pos->signttl;
// add . NS records
DNSResourceRecord rr;
+ rr.qname = DNSName(".");
rr.qtype=QType::NS;
rr.ttl=518400;
rr.d_place=DNSResourceRecord::AUTHORITY;