From 0175ebf35fd2d35e56607e5e805c001ce443d826 Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 10 Nov 2010 16:48:11 -0500 Subject: Also allow the user to enter an IP:FQDN record for MX, since it's valid and tinydns will create an A record automatically when given both. --- config/tinydns/tinydns.inc | 13 +++++++++++-- config/tinydns/tinydns_domains.xml | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/config/tinydns/tinydns.inc b/config/tinydns/tinydns.inc index dbfbd2a8..190a22cb 100644 --- a/config/tinydns/tinydns.inc +++ b/config/tinydns/tinydns.inc @@ -719,9 +719,18 @@ function tinydns_get_rowline_data($recordip, $recordtype, $ttl, $hostname, $rdns if(!$dist) $dist = "10"; // default to 10 if no preference has been defined. 0 is ugly. - // Check if we were given an IP, if so, put it in the ip field and leave the x field blank. + // Check if the user entered a custom record data with a : (for ip:host), and if it is valid, use it. + // If not, check if we were given an IP, if so, put it in the ip field and leave the x field blank. // Otherwise leave the IP blank and put in the hostname. - if (is_ipaddr($recordip)) + if (strpos($recordip, ':') !== false) { + list($rip, $rhost) = explode(':', $recordip); + if ((empty($rip) && is_hostname($rhost)) + || (empty($rhost) && is_ipaddr($rip)) + || (is_ipaddr($rip) && is_hostname($rhost))) + $record_string = $recordip; + else + break; // Don't add an invalid record. + } elseif (is_ipaddr($recordip)) $record_string = "{$recordip}:"; else $record_string = ":{$recordip}"; diff --git a/config/tinydns/tinydns_domains.xml b/config/tinydns/tinydns_domains.xml index d428d484..bf4de8fa 100644 --- a/config/tinydns/tinydns_domains.xml +++ b/config/tinydns/tinydns_domains.xml @@ -183,7 +183,7 @@ Record Data (FQDN, IP Address, or "raw" TinyDNS record) ipaddress - Enter the record data here. Use IP Address for A and PTR records. Use FQDN or Hostname for SOA and CNAME Records. NS Records use colon-separated IP and FQDN, e.g. 1.2.3.4:example.com + Enter the record data here. Use IP Address for A and PTR records. Use FQDN or Hostname for SOA and CNAME Records. MX records can be an IP, FQDN, or both separated by a colon, e.g. 1.2.3.4, mail.example.com, or 1.2.3.4:mail.example.com. NS Records use colon-separated IP and FQDN, e.g. 1.2.3.4:example.com input 80 -- cgit v1.2.3