diff --git a/DnsServerCore/Dns/Zones/AuthZoneInfo.cs b/DnsServerCore/Dns/Zones/AuthZoneInfo.cs index 801eaeb5..1206a242 100644 --- a/DnsServerCore/Dns/Zones/AuthZoneInfo.cs +++ b/DnsServerCore/Dns/Zones/AuthZoneInfo.cs @@ -55,6 +55,7 @@ namespace DnsServerCore.Dns.Zones readonly IReadOnlyCollection _notifyNameServers; readonly AuthZoneUpdate _update; readonly IReadOnlyCollection _updateIpAddresses; + readonly DateTime _lastModified; readonly DateTime _expiry; readonly IReadOnlyList _zoneHistory; //for IXFR support readonly IReadOnlyDictionary _zoneTransferTsigKeyNames; @@ -87,7 +88,7 @@ namespace DnsServerCore.Dns.Zones } } - public AuthZoneInfo(BinaryReader bR) + public AuthZoneInfo(BinaryReader bR, DateTime lastModified) { byte version = bR.ReadByte(); switch (version) @@ -99,6 +100,7 @@ namespace DnsServerCore.Dns.Zones case 5: case 6: case 7: + case 8: _name = bR.ReadShortString(); _type = (AuthZoneType)bR.ReadByte(); _disabled = bR.ReadBoolean(); @@ -169,6 +171,11 @@ namespace DnsServerCore.Dns.Zones } } + if (version >= 8) + _lastModified = bR.ReadDateTime(); + else + _lastModified = lastModified; + switch (_type) { case AuthZoneType.Primary: @@ -363,6 +370,7 @@ namespace DnsServerCore.Dns.Zones _notifyNameServers = _apexZone.NotifyNameServers; _update = _apexZone.Update; _updateIpAddresses = _apexZone.UpdateIpAddresses; + _lastModified = _apexZone.LastModified; } #endregion @@ -458,7 +466,7 @@ namespace DnsServerCore.Dns.Zones if (_apexZone is null) throw new InvalidOperationException(); - bW.Write((byte)7); //version + bW.Write((byte)8); //version bW.WriteShortString(_name); bW.Write((byte)_type); @@ -502,6 +510,8 @@ namespace DnsServerCore.Dns.Zones ipAddress.WriteTo(bW); } + bW.Write(_lastModified); + switch (_type) { case AuthZoneType.Primary: @@ -780,6 +790,17 @@ namespace DnsServerCore.Dns.Zones } } + public DateTime LastModified + { + get + { + if (_apexZone is null) + return _lastModified; + + return _apexZone.LastModified; + } + } + public DateTime Expiry { get