From f3f0c10c154d9ebd1e4fd927b4b80caa7ce5a4d1 Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 13 Jun 2020 18:49:08 +0530 Subject: [PATCH] WebService: Updated ResolveQuery() import feature to allow primary and forwarder zones for import. --- DnsServerCore/WebService.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/DnsServerCore/WebService.cs b/DnsServerCore/WebService.cs index 3e32db01..924f4935 100644 --- a/DnsServerCore/WebService.cs +++ b/DnsServerCore/WebService.cs @@ -3220,14 +3220,24 @@ namespace DnsServerCore if (zoneInfo == null) throw new DnsServerException("Cannot import records: failed to create primary zone."); } - else if (zoneInfo.Type != AuthZoneType.Primary) + else { - throw new DnsServerException("Cannot import records: import zone type must be primary."); + switch (zoneInfo.Type) + { + case AuthZoneType.Primary: + case AuthZoneType.Forwarder: + break; + + default: + throw new DnsServerException("Cannot import records: import zone must be of primary or forwarder type."); + } } if (type == DnsResourceRecordType.AXFR) { - _dnsServer.AuthZoneManager.SyncRecords(domain, dnsResponse.Answer); + bool dontRemoveRecords = zoneInfo.Type == AuthZoneType.Forwarder; + + _dnsServer.AuthZoneManager.SyncRecords(domain, dnsResponse.Answer, null, dontRemoveRecords); } else {