diff options
-rw-r--r-- | config/tinydns/tinydns.inc | 13 | ||||
-rw-r--r-- | 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 @@ <field> <fielddescr>Record Data (FQDN, IP Address, or "raw" TinyDNS record)</fielddescr> <fieldname>ipaddress</fieldname> - <description>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</description> + <description>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</description> <type>input</type> <size>80</size> <required/> |