mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-01-06 08:45:32 +00:00
Zone: fixed bug in GetClosestAuthority() by enabling CNAME bypass for reading SOA record. Empty response from authority name server caching done when SOA is missing due to bad config.
This commit is contained in:
@@ -427,7 +427,7 @@ namespace DnsServerCore
|
||||
|
||||
while (currentZone != null)
|
||||
{
|
||||
nsRecords = currentZone.QueryRecords(DnsResourceRecordType.SOA);
|
||||
nsRecords = currentZone.QueryRecords(DnsResourceRecordType.SOA, true);
|
||||
if ((nsRecords != null) && (nsRecords.Length > 0) && (nsRecords[0].Type == DnsResourceRecordType.SOA))
|
||||
return nsRecords;
|
||||
|
||||
@@ -744,6 +744,24 @@ namespace DnsServerCore
|
||||
CreateZone(this, question.Name).SetRecords(question.Type, new DnsResourceRecord[] { record });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (DnsQuestionRecord question in response.Question)
|
||||
{
|
||||
foreach (DnsResourceRecord authorityRecord in response.Authority)
|
||||
{
|
||||
if ((authorityRecord.Type == DnsResourceRecordType.NS) && question.Name.Equals(authorityRecord.Name, StringComparison.CurrentCultureIgnoreCase) && (authorityRecord.RDATA as DnsNSRecord).NSDomainName.Equals(response.NameServerAddress.Host, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
//empty response from authority name server
|
||||
DnsResourceRecord record = new DnsResourceRecord(question.Name, question.Type, DnsClass.IN, DEFAULT_RECORD_TTL, new DnsEmptyRecord(null));
|
||||
record.SetExpiry();
|
||||
|
||||
CreateZone(this, question.Name).SetRecords(question.Type, new DnsResourceRecord[] { record });
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user