示例#1
0
        public override void SetRecords(DnsResourceRecordType type, IReadOnlyList <DnsResourceRecord> records)
        {
            if (_primaryZone.DnssecStatus != AuthZoneDnssecStatus.Unsigned)
            {
                switch (type)
                {
                case DnsResourceRecordType.ANAME:
                case DnsResourceRecordType.APP:
                    throw new DnsServerException("The record type is not supported by DNSSEC signed primary zones.");

                default:
                    foreach (DnsResourceRecord record in records)
                    {
                        if (record.IsDisabled())
                        {
                            throw new DnsServerException("Cannot set records: disabling records in a signed zones is not supported.");
                        }
                    }

                    break;
                }
            }

            switch (type)
            {
            case DnsResourceRecordType.SOA:
                throw new InvalidOperationException("Cannot set SOA record on sub domain.");

            case DnsResourceRecordType.DNSKEY:
            case DnsResourceRecordType.RRSIG:
            case DnsResourceRecordType.NSEC:
            case DnsResourceRecordType.NSEC3PARAM:
            case DnsResourceRecordType.NSEC3:
                throw new InvalidOperationException("Cannot set DNSSEC records.");

            case DnsResourceRecordType.FWD:
                throw new DnsServerException("The record type is not supported by primary zones.");

            default:
                if (records[0].OriginalTtlValue > _primaryZone.GetZoneSoaExpire())
                {
                    throw new DnsServerException("Failed to set records: TTL cannot be greater than SOA EXPIRE.");
                }

                if (!TrySetRecords(type, records, out IReadOnlyList <DnsResourceRecord> deletedRecords))
                {
                    throw new DnsServerException("Failed to set records. Please try again.");
                }

                _primaryZone.CommitAndIncrementSerial(deletedRecords, records);

                if (_primaryZone.DnssecStatus != AuthZoneDnssecStatus.Unsigned)
                {
                    _primaryZone.UpdateDnssecRecordsFor(this, type);
                }

                _primaryZone.TriggerNotify();
                break;
            }
        }
示例#2
0
        public override void SetRecords(DnsResourceRecordType type, IReadOnlyList <DnsResourceRecord> records)
        {
            base.SetRecords(type, records);

            _primaryZone.IncrementSoaSerial();
            _primaryZone.TriggerNotify();
        }
示例#3
0
        public override void SetRecords(DnsResourceRecordType type, IReadOnlyList <DnsResourceRecord> records)
        {
            if (!SetRecords(type, records, out IReadOnlyList <DnsResourceRecord> deletedRecords))
            {
                throw new DnsServerException("Failed to set records. Please try again.");
            }

            _primaryZone.CommitAndIncrementSerial(deletedRecords, records);
            _primaryZone.TriggerNotify();
        }