Bug #6566
closedCloudflare DnyDNS Update with subdomains
0%
Description
If a host such as ip.example.co.uk is used for the cloudflare dynamic dns update the zone_id will fail to be returned.
I believe this is due to the following code from src/etc/inc/dyndns.class:
$dnsHost = str_replace(' ', '', $this->_dnsHost);
$host_names = explode(".", $dnsHost);
$bottom_host_name = $host_names[count($host_names)-2] . "." . $host_names[count($host_names)-1];
as $bottom_host_name
would end up as "co.uk".
Something like this:
$dnsHost = str_replace(' ', '', $this->_dnsHost);
$host_names = explode(".", $dnsHost);
if (count($host_names) > 3) {
$bottom_host_name = $host_names[count($host_names)-3] . "." . $host_names[count($host_names)-2] . "." . $host_names[count($host_names)-1];
} else {
$bottom_host_name = $host_names[count($host_names)-2] . "." . $host_names[count($host_names)-1];
}
would check if the hostname contains more than three parts and would correctly retrieve the zone_id from cloudflare - I've tested it with ip.example.co.uk but my php isn't great so someone might want to improve it.