BlockListZoneManager: updated allowed list implementation to check for domains zone wise so that subdomain names from blocked lists too are allowed.

This commit is contained in:
Shreyas Zare
2021-08-21 12:13:08 +05:30
parent 24eba0c080
commit da56c453c7

View File

@@ -223,12 +223,26 @@ namespace DnsServerCore.Dns.ZoneManagers
domain = GetParentZone(domain);
}
while (domain != null);
while (domain is not null);
blockedDomain = null;
return null;
}
private bool IsZoneAllowed(Dictionary<string, object> allowedDomains, string domain)
{
do
{
if (allowedDomains.TryGetValue(domain, out _))
return true;
domain = GetParentZone(domain);
}
while (domain is not null);
return false;
}
#endregion
#region public
@@ -275,7 +289,7 @@ namespace DnsServerCore.Dns.ZoneManagers
{
string domain = queue.Dequeue();
if (allowedDomains.TryGetValue(domain, out _))
if (IsZoneAllowed(allowedDomains, domain))
continue; //domain is in allowed list so skip adding it to block list zone
if (!blockListZone.TryGetValue(domain, out List<Uri> blockLists))