mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2025-12-26 03:17:55 +00:00
AllowedZoneManager & BlockedZoneManager: Using AuthZoneManager's TotalZones.
This commit is contained in:
@@ -39,8 +39,6 @@ namespace DnsServerCore.Dns.ZoneManagers
|
|||||||
DnsSOARecord _soaRecord;
|
DnsSOARecord _soaRecord;
|
||||||
DnsNSRecord _nsRecord;
|
DnsNSRecord _nsRecord;
|
||||||
|
|
||||||
int _totalZonesAllowed;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region constructor
|
#region constructor
|
||||||
@@ -121,10 +119,7 @@ namespace DnsServerCore.Dns.ZoneManagers
|
|||||||
public bool AllowZone(string domain)
|
public bool AllowZone(string domain)
|
||||||
{
|
{
|
||||||
if (_zoneManager.CreateInternalPrimaryZone(domain, _soaRecord, _nsRecord) != null)
|
if (_zoneManager.CreateInternalPrimaryZone(domain, _soaRecord, _nsRecord) != null)
|
||||||
{
|
|
||||||
_totalZonesAllowed++;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -132,10 +127,7 @@ namespace DnsServerCore.Dns.ZoneManagers
|
|||||||
public bool DeleteZone(string domain)
|
public bool DeleteZone(string domain)
|
||||||
{
|
{
|
||||||
if (_zoneManager.DeleteZone(domain))
|
if (_zoneManager.DeleteZone(domain))
|
||||||
{
|
|
||||||
_totalZonesAllowed--;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -159,8 +151,6 @@ namespace DnsServerCore.Dns.ZoneManagers
|
|||||||
{
|
{
|
||||||
List<AuthZoneInfo> allowedZones = _dnsServer.AllowedZoneManager.ListZones();
|
List<AuthZoneInfo> allowedZones = _dnsServer.AllowedZoneManager.ListZones();
|
||||||
|
|
||||||
_totalZonesAllowed = allowedZones.Count;
|
|
||||||
|
|
||||||
string allowedZoneFile = Path.Combine(_dnsServer.ConfigFolder, "allowed.config");
|
string allowedZoneFile = Path.Combine(_dnsServer.ConfigFolder, "allowed.config");
|
||||||
|
|
||||||
using (FileStream fS = new FileStream(allowedZoneFile, FileMode.Create, FileAccess.Write))
|
using (FileStream fS = new FileStream(allowedZoneFile, FileMode.Create, FileAccess.Write))
|
||||||
@@ -197,7 +187,7 @@ namespace DnsServerCore.Dns.ZoneManagers
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int TotalZonesAllowed
|
public int TotalZonesAllowed
|
||||||
{ get { return _totalZonesAllowed; } }
|
{ get { return _zoneManager.TotalZones; } }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ namespace DnsServerCore.Dns.ZoneManagers
|
|||||||
DnsSOARecord _soaRecord;
|
DnsSOARecord _soaRecord;
|
||||||
DnsNSRecord _nsRecord;
|
DnsNSRecord _nsRecord;
|
||||||
|
|
||||||
int _totalZonesBlocked;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region constructor
|
#region constructor
|
||||||
@@ -139,10 +137,7 @@ namespace DnsServerCore.Dns.ZoneManagers
|
|||||||
public bool BlockZone(string domain)
|
public bool BlockZone(string domain)
|
||||||
{
|
{
|
||||||
if (_zoneManager.CreateInternalPrimaryZone(domain, _soaRecord, _nsRecord) != null)
|
if (_zoneManager.CreateInternalPrimaryZone(domain, _soaRecord, _nsRecord) != null)
|
||||||
{
|
|
||||||
_totalZonesBlocked++;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -150,10 +145,7 @@ namespace DnsServerCore.Dns.ZoneManagers
|
|||||||
public bool DeleteZone(string domain)
|
public bool DeleteZone(string domain)
|
||||||
{
|
{
|
||||||
if (_zoneManager.DeleteZone(domain))
|
if (_zoneManager.DeleteZone(domain))
|
||||||
{
|
|
||||||
_totalZonesBlocked--;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -213,7 +205,7 @@ namespace DnsServerCore.Dns.ZoneManagers
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int TotalZonesBlocked
|
public int TotalZonesBlocked
|
||||||
{ get { return _totalZonesBlocked; } }
|
{ get { return _zoneManager.TotalZones; } }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user