mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-04-05 04:09:28 +00:00
AuthZone: code refactoring changes.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Technitium DNS Server
|
||||
Copyright (C) 2022 Shreyas Zare (shreyas@technitium.com)
|
||||
Copyright (C) 2023 Shreyas Zare (shreyas@technitium.com)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -56,22 +56,30 @@ namespace DnsServerCore.Dns.Zones
|
||||
|
||||
if (records.Count == 1)
|
||||
{
|
||||
if (records[0].IsDisabled())
|
||||
AuthRecordInfo authRecordInfo = records[0].GetAuthRecordInfo();
|
||||
|
||||
if (authRecordInfo.Disabled)
|
||||
return Array.Empty<DnsResourceRecord>(); //record disabled
|
||||
|
||||
//update last used on
|
||||
records[0].GetRecordInfo().LastUsedOn = DateTime.UtcNow;
|
||||
authRecordInfo.LastUsedOn = DateTime.UtcNow;
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
List<DnsResourceRecord> newRecords = new List<DnsResourceRecord>(records.Count);
|
||||
DateTime utcNow = DateTime.UtcNow;
|
||||
|
||||
foreach (DnsResourceRecord record in records)
|
||||
{
|
||||
if (record.IsDisabled())
|
||||
AuthRecordInfo authRecordInfo = record.GetAuthRecordInfo();
|
||||
|
||||
if (authRecordInfo.Disabled)
|
||||
continue; //record disabled
|
||||
|
||||
//update last used on
|
||||
authRecordInfo.LastUsedOn = utcNow;
|
||||
|
||||
newRecords.Add(record);
|
||||
}
|
||||
|
||||
@@ -87,12 +95,6 @@ namespace DnsServerCore.Dns.Zones
|
||||
}
|
||||
}
|
||||
|
||||
//update last used on
|
||||
DateTime utcNow = DateTime.UtcNow;
|
||||
|
||||
foreach (DnsResourceRecord record in newRecords)
|
||||
record.GetRecordInfo().LastUsedOn = utcNow;
|
||||
|
||||
return newRecords;
|
||||
}
|
||||
|
||||
@@ -112,7 +114,7 @@ namespace DnsServerCore.Dns.Zones
|
||||
{
|
||||
if ((rrsigRecord.RDATA as DnsRRSIGRecordData).TypeCovered == type)
|
||||
{
|
||||
rrsigRecord.GetRecordInfo().LastUsedOn = utcNow;
|
||||
rrsigRecord.GetAuthRecordInfo().LastUsedOn = utcNow;
|
||||
newRecords.Add(rrsigRecord);
|
||||
}
|
||||
}
|
||||
@@ -901,7 +903,7 @@ namespace DnsServerCore.Dns.Zones
|
||||
|
||||
foreach (DnsResourceRecord record in records)
|
||||
{
|
||||
if (record.IsDisabled())
|
||||
if (record.GetAuthRecordInfo().Disabled)
|
||||
continue;
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user