From 4a7e770d2f2c3d4fc3eb231a8771526d1e9ddb1f Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sun, 13 Aug 2023 18:48:20 +0530 Subject: [PATCH] AuthZoneManager: fixed issue in IXFR which caused empty node to remain in the zone tree. --- DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs b/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs index 41ed2693..ec706aa9 100644 --- a/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs +++ b/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs @@ -1826,9 +1826,16 @@ namespace DnsServerCore.Dns.ZoneManagers AuthZone zone = GetOrAddSubDomainZone(zoneName, deletedEntry.Key); if (zone.Name.Equals(zoneName, StringComparison.OrdinalIgnoreCase)) + { zone.SyncRecords(deletedEntry.Value, null); + } else if ((zone is SubDomainZone subDomainZone) && subDomainZone.AuthoritativeZone.Name.Equals(zoneName, StringComparison.OrdinalIgnoreCase)) + { zone.SyncRecords(deletedEntry.Value, null); + + if (zone.IsEmpty) + _root.TryRemove(deletedEntry.Key, out SubDomainZone _); //remove empty sub zone + } } }