WebServiceApi: updated ResolveQueryAsync() to detect if new primary zone is to be created.
This commit is contained in:
parent
3d43c9894d
commit
85b4ff4152
@ -321,8 +321,28 @@ namespace DnsServerCore
|
|||||||
|
|
||||||
if (importResponse)
|
if (importResponse)
|
||||||
{
|
{
|
||||||
|
bool isZoneImport = false;
|
||||||
|
|
||||||
|
if (type == DnsResourceRecordType.AXFR)
|
||||||
|
{
|
||||||
|
isZoneImport = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (DnsResourceRecord record in dnsResponse.Answer)
|
||||||
|
{
|
||||||
|
if (record.Type == DnsResourceRecordType.SOA)
|
||||||
|
{
|
||||||
|
if (record.Name.Equals(domain, StringComparison.OrdinalIgnoreCase))
|
||||||
|
isZoneImport = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AuthZoneInfo zoneInfo = _dnsWebService.DnsServer.AuthZoneManager.FindAuthZoneInfo(domain);
|
AuthZoneInfo zoneInfo = _dnsWebService.DnsServer.AuthZoneManager.FindAuthZoneInfo(domain);
|
||||||
if ((zoneInfo is null) || ((zoneInfo.Type == AuthZoneType.Secondary) && !zoneInfo.Name.Equals(domain, StringComparison.OrdinalIgnoreCase)))
|
if ((zoneInfo is null) || ((zoneInfo.Type != AuthZoneType.Primary) && !zoneInfo.Name.Equals(domain, StringComparison.OrdinalIgnoreCase)) || (isZoneImport && !zoneInfo.Name.Equals(domain, StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
if (!_dnsWebService._authManager.IsPermitted(PermissionSection.Zones, session.User, PermissionFlag.Modify))
|
if (!_dnsWebService._authManager.IsPermitted(PermissionSection.Zones, session.User, PermissionFlag.Modify))
|
||||||
throw new DnsWebServiceException("Access was denied.");
|
throw new DnsWebServiceException("Access was denied.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user