Beispiel #1
0
        public override void UpdateSoaRecord(string zoneName, string host, string primaryNsServer, string primaryPerson)
        {
            if (ZoneExists(zoneName))
            {
                //
                if (String.IsNullOrEmpty(primaryPerson))
                {
                    primaryPerson = "hostmaster";
                }
                //
                Connection cn = SetupProviderConnection();

                DNSZone dnsZone = cn.GetZone(zoneName);
                dnsZone.Comments = "Updated by WebsitePanel DNS API at " + DateTime.Now.ToString();

                DNSRecord soaRecord = (dnsZone.Records.Count == 0) ? dnsZone.Records.Add("@", "SOA") : dnsZone.Records[0];
                // Fill record fields with the data
                soaRecord.DataFields[SOA_PRIMARY_NAME_SERVER] = CorrectSOARecord(zoneName, primaryNsServer);
                soaRecord.DataFields[SOA_RESPONSIBLE_PERSON]  = primaryPerson;
                soaRecord.DataFields[SOA_SERIAL_NUMBER]       = UpdateSerialNumber(soaRecord.DataFields[SOA_SERIAL_NUMBER]);
                soaRecord.DataFields[SOA_REFRESH_INTERVAL]    = RefreshInterval.ToString();
                soaRecord.DataFields[SOA_RETRY_DELAY]         = RetryDelay.ToString();
                soaRecord.DataFields[SOA_EXPIRE_LIMIT]        = ExpireLimit.ToString();
                soaRecord.DataFields[SOA_MINIMUM_TTL]         = MinimumTTL.ToString();

                // remove "dumb" internal Name Server
                string internalNameServer = System.Net.Dns.GetHostEntry("LocalHost").HostName;
                dnsZone.Records.Remove(zoneName, "NS", internalNameServer);

                // save zone
                cn.UpdateZone(dnsZone, false);
            }
        }
Beispiel #2
0
        public override void AddPrimaryZone(string zoneName, string[] secondaryServers)
        {
            Connection cn = SetupProviderConnection();

            // CREATE PRIMARY DNS ZONE
            string  primaryNameServer = System.Net.Dns.GetHostEntry("LocalHost").HostName;
            DNSZone zoneObj           = cn.CreateZone(zoneName, primaryNameServer, "hostmaster");

            zoneObj.Comments = String.Concat("Created with SolidCP DNS API at ", DateTime.Now);

            // Setup zone data transfer
            if (secondaryServers != null && secondaryServers.Length != 0)
            {
                if (secondaryServers.Length == 1 && secondaryServers[0] == "*")
                {
                    zoneObj.AllowZoneTransfer = "*";
                }
                else
                {
                    zoneObj.AllowZoneTransfer = String.Join(" ", secondaryServers);
                }
            }

            // Update SOA record
            DNSRecord soaRecord = zoneObj.Records[0];

            soaRecord.DataFields[SOA_PRIMARY_NAME_SERVER] = CorrectSOARecord(zoneName, primaryNameServer);
            soaRecord.DataFields[SOA_RESPONSIBLE_PERSON]  = CorrectSOARecord(zoneName, "hostmaster");
            // Issue new serial number for the zone
            soaRecord.DataFields[SOA_SERIAL_NUMBER]    = UpdateSerialNumber(null);
            soaRecord.DataFields[SOA_REFRESH_INTERVAL] = RefreshInterval.ToString();
            soaRecord.DataFields[SOA_RETRY_DELAY]      = RetryDelay.ToString();
            soaRecord.DataFields[SOA_EXPIRE_LIMIT]     = ExpireLimit.ToString();
            soaRecord.DataFields[SOA_MINIMUM_TTL]      = MinimumTTL.ToString();

            // Publish updates are made
            cn.UpdateZone(zoneObj, false);
        }
Beispiel #3
0
        void ReleaseDesignerOutlets()
        {
            if (AdminEmail != null)
            {
                AdminEmail.Dispose();
                AdminEmail = null;
            }

            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

            if (ExpiresAfter != null)
            {
                ExpiresAfter.Dispose();
                ExpiresAfter = null;
            }

            if (MinimumTTL != null)
            {
                MinimumTTL.Dispose();
                MinimumTTL = null;
            }

            if (PrimaryServerName != null)
            {
                PrimaryServerName.Dispose();
                PrimaryServerName = null;
            }

            if (RefreshInterval != null)
            {
                RefreshInterval.Dispose();
                RefreshInterval = null;
            }

            if (RetryInterval != null)
            {
                RetryInterval.Dispose();
                RetryInterval = null;
            }

            if (SerialNumber != null)
            {
                SerialNumber.Dispose();
                SerialNumber = null;
            }

            if (UpdateButton != null)
            {
                UpdateButton.Dispose();
                UpdateButton = null;
            }

            if (ZoneType != null)
            {
                ZoneType.Dispose();
                ZoneType = null;
            }
        }