AllowedZoneManager & BlockedZoneManager: Using AuthZoneManager's TotalZones.

This commit is contained in:
Shreyas Zare
2020-12-25 18:25:40 +05:30
parent 8df4c4c0f8
commit f0dd31ae6d
2 changed files with 2 additions and 20 deletions

View File

@@ -39,8 +39,6 @@ namespace DnsServerCore.Dns.ZoneManagers
DnsSOARecord _soaRecord;
DnsNSRecord _nsRecord;
int _totalZonesAllowed;
#endregion
#region constructor
@@ -121,10 +119,7 @@ namespace DnsServerCore.Dns.ZoneManagers
public bool AllowZone(string domain)
{
if (_zoneManager.CreateInternalPrimaryZone(domain, _soaRecord, _nsRecord) != null)
{
_totalZonesAllowed++;
return true;
}
return false;
}
@@ -132,10 +127,7 @@ namespace DnsServerCore.Dns.ZoneManagers
public bool DeleteZone(string domain)
{
if (_zoneManager.DeleteZone(domain))
{
_totalZonesAllowed--;
return true;
}
return false;
}
@@ -159,8 +151,6 @@ namespace DnsServerCore.Dns.ZoneManagers
{
List<AuthZoneInfo> allowedZones = _dnsServer.AllowedZoneManager.ListZones();
_totalZonesAllowed = allowedZones.Count;
string allowedZoneFile = Path.Combine(_dnsServer.ConfigFolder, "allowed.config");
using (FileStream fS = new FileStream(allowedZoneFile, FileMode.Create, FileAccess.Write))
@@ -197,7 +187,7 @@ namespace DnsServerCore.Dns.ZoneManagers
}
public int TotalZonesAllowed
{ get { return _totalZonesAllowed; } }
{ get { return _zoneManager.TotalZones; } }
#endregion
}

View File

@@ -39,8 +39,6 @@ namespace DnsServerCore.Dns.ZoneManagers
DnsSOARecord _soaRecord;
DnsNSRecord _nsRecord;
int _totalZonesBlocked;
#endregion
#region constructor
@@ -139,10 +137,7 @@ namespace DnsServerCore.Dns.ZoneManagers
public bool BlockZone(string domain)
{
if (_zoneManager.CreateInternalPrimaryZone(domain, _soaRecord, _nsRecord) != null)
{
_totalZonesBlocked++;
return true;
}
return false;
}
@@ -150,10 +145,7 @@ namespace DnsServerCore.Dns.ZoneManagers
public bool DeleteZone(string domain)
{
if (_zoneManager.DeleteZone(domain))
{
_totalZonesBlocked--;
return true;
}
return false;
}
@@ -213,7 +205,7 @@ namespace DnsServerCore.Dns.ZoneManagers
}
public int TotalZonesBlocked
{ get { return _totalZonesBlocked; } }
{ get { return _zoneManager.TotalZones; } }
#endregion
}