diff options
author | jim-p <jimp@pfsense.org> | 2012-01-26 12:11:58 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2012-01-26 12:18:26 -0500 |
commit | e8fc69ff43bb089f90de4f87f02db44f55a96b40 (patch) | |
tree | d6781e51e232c30f05e1b58eb0d903e743627aaf | |
parent | 6f0dc800b7b9c7527f9660c3569a32ce8aa2e35a (diff) | |
download | pfsense-e8fc69ff43bb089f90de4f87f02db44f55a96b40.zip pfsense-e8fc69ff43bb089f90de4f87f02db44f55a96b40.tar.gz |
Be smarter about how to split a Namecheap hostname into host/domain. Fixes #2144
-rw-r--r-- | etc/inc/dyndns.class | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class index 0f4715d..5c853a9 100644 --- a/etc/inc/dyndns.class +++ b/etc/inc/dyndns.class @@ -390,7 +390,11 @@ $needsIP = FALSE; log_error("Namecheap: DNS update() starting."); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); - list($hostname, $domain) = explode(".", $this->_dnsHost, 2); + $dparts = explode(".", $this->_dnsHost); + $domain_part_count = ($dparts[count($dparts)-1] == "uk") ? 3 : 2; + $domain_offset = count($dparts) - $domain_part_count; + $hostname = implode(".", array_slice($dparts, 0, $domain_offset)); + $domain = implode(".", array_slice($dparts, $domain_offset)); $server = "https://dynamicdns.park-your-domain.com/update?host={$hostname}&domain={$domain}&password={$this->_dnsPass}&ip={$this->_dnsIP}"; curl_setopt($ch, CURLOPT_URL, $server); break; |