mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-01-03 07:15:34 +00:00
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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user