From c7ed22cef43cd87e9e0c9e95e28ba4929f74e9ab Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sun, 13 Jan 2019 17:32:10 +0530 Subject: [PATCH] hotfix: fixed CNAME issue that get introduced by previous changes. --- DnsServerCore/Zone.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/DnsServerCore/Zone.cs b/DnsServerCore/Zone.cs index 64f3f923..f585c485 100644 --- a/DnsServerCore/Zone.cs +++ b/DnsServerCore/Zone.cs @@ -292,13 +292,18 @@ namespace DnsServerCore { if (type == DnsResourceRecordType.CNAME) { - if (!_zones.IsEmpty) - throw new DnsServerException("Cannot add CNAME record: sub domains exists in same zone"); - foreach (DnsResourceRecordType key in _entries.Keys) { - if (key != DnsResourceRecordType.SOA) - throw new DnsServerException("Cannot add CNAME record: other records exists in same zone"); + switch (key) + { + case DnsResourceRecordType.SOA: + case DnsResourceRecordType.NS: + case DnsResourceRecordType.CNAME: + continue; + + default: + throw new DnsServerException("Cannot add CNAME record: other records exists in same zone"); + } } }