check for CNAME presence

This commit is contained in:
bert hubert
2018-04-17 20:45:51 +02:00
parent 44bde39dbc
commit 97e3a1b3bc

View File

@ -87,6 +87,10 @@ void DNSNode::visit(std::function<void(const DNSName& name, const DNSNode*)> vis
void DNSNode::addRRs(std::unique_ptr<RRGen>&&a)
{
if(a->getType() == DNSType::CNAME && rrsets.size())
throw std::runtime_error("Can't add CNAME RR to a node that already has RRs present");
else if(rrsets.count(DNSType::CNAME))
throw std::runtime_error("Can't add an RR to a node that already has a CNAME");
rrsets[a->getType()].add(std::move(a));
}