From 2d78b166f32f9b36e4d5b7827b5e80da02b6e22c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=C3=A7i?= Date: Mon, 4 Aug 2008 18:15:22 +0000 Subject: Implement OpenDNS and fixup some indent. --- etc/inc/dyndns.class | 61 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 10 deletions(-) (limited to 'etc/inc/dyndns.class') diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class index 811a990..1ec6f5a 100644 --- a/etc/inc/dyndns.class +++ b/etc/inc/dyndns.class @@ -16,6 +16,7 @@ * - Loopia (loopia.se) * - StaticCling (staticcling.org) * - DNSexit (dnsexit.com) + * - OpenDNS (opendns.com) * +----------------------------------------------------+ * Requirements: * - PHP version 4.0.2 or higher with CURL Library @@ -45,6 +46,7 @@ * Loopia - Last Tested: NEVER * StaticCling - Last Tested: 27 April 2006 * DNSexit - Last Tested: 20 July 2008 + * OpenDNS - Last Tested: 4 August 2008 * +====================================================+ * * @author E.Kristensen @@ -52,7 +54,7 @@ * @version 0.8 * @updated 13 October 05 at 21:02:42 GMT * - * DNSexit support and multiwan extension for pfSense by Ermal Luçi + * DNSexit/OpenDNS support and multiwan extension for pfSense by Ermal Luçi * */ @@ -138,7 +140,8 @@ $this->_dnsService == 'freedns' || $this->_dnsService == 'loopia' || $this->_dnsService == 'staticcling'|| - $this->_dnsService == 'dnsexit') + $this->_dnsService == 'dnsexit' || + $this->_dnsService == 'opendns') { $this->_update(); } else { @@ -390,14 +393,33 @@ curl_close($ch); $this->_checkStatus($data); break; - case 'staticcling': - $needsIP = FALSE; - curl_setopt($ch, CURLOPT_URL, 'http://www.staticcling.org/update.html?login='.$this->_dnsUser.'&pass='.$this->_dnsPass); - $data = curl_exec($ch); - if (@curl_error($ch)) log_error("Curl error occured: " . curl_error($ch)); - curl_close($ch); - $this->_checkStatus($data); - break; + case 'opendns': + $needsIP = FALSE; + log_error("DynDns: DynDns _update() starting. Dynamic"); + if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") $this->_dnsWildcard = "ON"; + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); + $server = "https://updates.opendns.com/nic/update?hostname="; + $port = ""; + if($this->_dnsServer) + $server = $this->_dnsServer; + if($this->_dnsPort) + $port = ":" . $this->_dnsPort; + curl_setopt($ch, CURLOPT_URL, $server .$port); + $data = curl_exec($ch); + if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); + curl_close($ch); + $this->_checkStatus($data); + break; + + case 'staticcling': + $needsIP = FALSE; + curl_setopt($ch, CURLOPT_URL, 'http://www.staticcling.org/update.html?login='.$this->_dnsUser.'&pass='.$this->_dnsPass); + $data = curl_exec($ch); + if (@curl_error($ch)) log_error("Curl error occured: " . curl_error($ch)); + curl_close($ch); + $this->_checkStatus($data); + break; case 'dnsomatic': /* Example syntax @@ -680,6 +702,25 @@ $this->_debug($data); } break; + case 'opendns': + if (preg_match('/badauth/i', $data)) { + $status = "phpDynDNS: (Error) Not a valid username or password!"; + } else if (preg_match('/nohost/i', $data)) { + $status = "phpDynDNS: (Error) Hostname you are trying to update does not exist."; + $successful_update = true; + } else if (preg_match('/good/i', $data)) { + $status = "phpDynDNS: (Success) IP Address Changed Successfully! (".$this->_dnsIP.")"; + $successful_update = true; + } else if (preg_match('/yours/i', $data)) { + $status = "phpDynDNS: (Error) hostname specified exists, but not under the username specified."; + } else if (preg_match('/abuse/i', $data)) { + $status = "phpDynDns: (Error) Updating to frequently, considered abuse."; + } else { + $status = "phpDynDNS: (Unknown Response)"; + log_error("phpDynDNS: PAYLOAD: {$data}"); + $this->_debug($data); + } + break; case 'staticcling': if (preg_match("/invalid ip/i", $data)) { $status = "phpDynDNS: (Error) Bad Request - The IP provided was invalid."; -- cgit v1.1