From deb9ff87061e14c96e510bb3cbd43a77685a0baa Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 6 Mar 2021 16:36:16 +0530 Subject: [PATCH] AuthZoneManager: updated GetApplicationResponse to respond with SOA when there is no APP record available. Updated CreateApplicationZone to create app zone similar to primary zone. Added support to APP record in UpdateRecord. Added missing app zone type in ListZones(). --- DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs b/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs index 889d3a87..399fdc30 100644 --- a/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs +++ b/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs @@ -245,7 +245,7 @@ namespace DnsServerCore.Dns.ZoneManagers else if (authZone is ForwarderZone) return new ForwarderSubDomainZone(domain); else if (authZone is ApplicationZone) - return new ApplicationSubDomainZone(domain); + return new ApplicationSubDomainZone(authZone as ApplicationZone, domain); throw new DnsServerException("Zone cannot have sub domains."); }); @@ -340,7 +340,10 @@ namespace DnsServerCore.Dns.ZoneManagers if ((authority == null) || (authority.Count == 0)) authority = applicationZone.QueryRecords(DnsResourceRecordType.APP); - return new DnsDatagram(request.Identifier, true, DnsOpcode.StandardQuery, false, false, request.RecursionDesired, false, false, false, DnsResponseCode.NoError, request.Question, null, authority); + if ((authority == null) || (authority.Count == 0)) + authority = applicationZone.QueryRecords(DnsResourceRecordType.SOA); + + return new DnsDatagram(request.Identifier, true, DnsOpcode.StandardQuery, true, false, request.RecursionDesired, false, false, false, DnsResponseCode.NoError, request.Question, null, authority); } internal void Flush() @@ -545,9 +548,9 @@ namespace DnsServerCore.Dns.ZoneManagers return null; } - public AuthZoneInfo CreateApplicationZone(string domain, string package, string classPath, string data) + public AuthZoneInfo CreateApplicationZone(string domain, string primaryNameServer, string appName, string classPath, string data) { - AuthZone authZone = new ApplicationZone(domain, package, classPath, data); + AuthZone authZone = new ApplicationZone(domain, primaryNameServer, appName, classPath, data); if (_root.TryAdd(authZone)) { @@ -810,6 +813,7 @@ namespace DnsServerCore.Dns.ZoneManagers case DnsResourceRecordType.CNAME: case DnsResourceRecordType.ANAME: case DnsResourceRecordType.PTR: + case DnsResourceRecordType.APP: if (oldRecord.Name.Equals(newRecord.Name, StringComparison.OrdinalIgnoreCase)) { zone.SetRecords(newRecord.Type, new DnsResourceRecord[] { newRecord }); @@ -915,6 +919,7 @@ namespace DnsServerCore.Dns.ZoneManagers case AuthZoneType.Secondary: case AuthZoneType.Stub: case AuthZoneType.Forwarder: + case AuthZoneType.Application: zones.Add(zoneInfo); break; }