From 97e3a1b3bc31b90ff5a4e454cb0d31decaa6746e Mon Sep 17 00:00:00 2001 From: bert hubert Date: Tue, 17 Apr 2018 20:45:51 +0200 Subject: [PATCH] check for CNAME presence --- tdns/dns-storage.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tdns/dns-storage.cc b/tdns/dns-storage.cc index 8c53177..56b9832 100644 --- a/tdns/dns-storage.cc +++ b/tdns/dns-storage.cc @@ -87,6 +87,10 @@ void DNSNode::visit(std::function vis void DNSNode::addRRs(std::unique_ptr&&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)); }