diff options
author | jim-p <jimp@pfsense.org> | 2010-11-10 16:48:11 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2010-11-10 16:48:11 -0500 |
commit | 0175ebf35fd2d35e56607e5e805c001ce443d826 (patch) | |
tree | 6fd0c363982adf5ea0bc21b2e45b8fa636152b0a /config/tinydns/tinydns.inc | |
parent | 90b413bae3c32a5aff5ea2f45bcd0e01a16b7197 (diff) | |
download | pfsense-packages-0175ebf35fd2d35e56607e5e805c001ce443d826.tar.gz pfsense-packages-0175ebf35fd2d35e56607e5e805c001ce443d826.tar.bz2 pfsense-packages-0175ebf35fd2d35e56607e5e805c001ce443d826.zip |
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.
Diffstat (limited to 'config/tinydns/tinydns.inc')
-rw-r--r-- | config/tinydns/tinydns.inc | 13 |
1 files changed, 11 insertions, 2 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}"; |