summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormortencombat <kennethvestergaard@gmail.com>2015-09-21 21:16:25 +0200
committerRenato Botelho <renato@netgate.com>2015-09-21 16:53:20 -0300
commitbf213d1d10dc7452cc1587ec727fede2c58d82f3 (patch)
tree46b370376e29b70080c4f56f41b83bc023a71395 /src
parent66c521145f75413d0b67a7563dd0cf5e25ca5ea8 (diff)
downloadpfsense-bf213d1d10dc7452cc1587ec727fede2c58d82f3.zip
pfsense-bf213d1d10dc7452cc1587ec727fede2c58d82f3.tar.gz
GratisDNS support for hosts without subdomains
Resubmit of #1793
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/dyndns.class11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/etc/inc/dyndns.class b/src/etc/inc/dyndns.class
index 382263d..bd5fa9c 100644
--- a/src/etc/inc/dyndns.class
+++ b/src/etc/inc/dyndns.class
@@ -728,8 +728,15 @@
log_error("GratisDNS.dk ({$this->_dnsHost}): DNS update() starting.");
}
$server = "https://ssl.gratisdns.dk/ddns.phtml";
- list($hostname, $domain) = explode(".", $this->_dnsHost, 2);
- curl_setopt($ch, CURLOPT_URL, $server . '?u=' . $this->_dnsUser . '&p=' . $this->_dnsPass . '&h=' . $this->_dnsHost . '&d=' . $domain . '&i=' . $this->_dnsIP);
+ $host = trim($this->_dnsHost);
+ $hostnames = explode(".", $host);
+ $hostnames_count = count($hostnames);
+ if ($hostnames_count > 2) {
+ $domain = $hostnames[$hostnames_count-2] . "." . $hostnames[$hostnames_count-1];
+ } else {
+ $domain = $host;
+ }
+ curl_setopt($ch, CURLOPT_URL, $server . '?u=' . $this->_dnsUser . '&p=' . $this->_dnsPass . '&h=' . $host . '&d=' . $domain . '&i=' . $this->_dnsIP);
break;
case 'ovh-dynhost':
$needsIP = FALSE;
OpenPOWER on IntegriCloud