summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authormortencombat <kennethvestergaard@gmail.com>2015-09-21 21:16:25 +0200
committerRenato Botelho <renato@netgate.com>2015-09-21 17:00:05 -0300
commit809ffcdbaa8ad9dc4c1316900a4a18c1a7f738b8 (patch)
tree2f657d45a6c8a45cdb354b90d49e57cf7dd4fc5c /etc
parent03ae5544b5d3e566b9fed76beda95b3a558d76e6 (diff)
downloadpfsense-809ffcdbaa8ad9dc4c1316900a4a18c1a7f738b8.zip
pfsense-809ffcdbaa8ad9dc4c1316900a4a18c1a7f738b8.tar.gz
GratisDNS support for hosts without subdomains
Resubmit of #1793
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/dyndns.class11
1 files changed, 9 insertions, 2 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class
index 5633ade..0bcaf56 100644
--- a/etc/inc/dyndns.class
+++ b/etc/inc/dyndns.class
@@ -659,8 +659,15 @@
if ($this->_dnsVerboseLog)
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