summaryrefslogtreecommitdiffstats
path: root/etc/inc/dyndns.class
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-04-13 22:19:00 +0000
committerErmal <eri@pfsense.org>2010-04-13 22:19:00 +0000
commit52e952864906792ffd2a03fa630df6b4f17c0073 (patch)
tree0e65d153e0ec4680a89968fd8a5c9c408e46313a /etc/inc/dyndns.class
parentc3c3e03bf19cfb4e859375f02786aa0c5a4ff2f0 (diff)
downloadpfsense-52e952864906792ffd2a03fa630df6b4f17c0073.zip
pfsense-52e952864906792ffd2a03fa630df6b4f17c0073.tar.gz
Add a timeout for curl_exec. Combine all dyndns.org methods to one catching up with its API changes.
Diffstat (limited to 'etc/inc/dyndns.class')
-rw-r--r--etc/inc/dyndns.class41
1 files changed, 5 insertions, 36 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class
index a4f542b..29011fb 100644
--- a/etc/inc/dyndns.class
+++ b/etc/inc/dyndns.class
@@ -171,29 +171,15 @@
curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_INTERFACE, $this->_ifIP);
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30); // Completely empirical
}
switch ($this->_dnsService) {
case 'dyndns':
- $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://members.dyndns.org/nic/update";
- $port = "";
- if($this->_dnsServer)
- $server = $this->_dnsServer;
- if($this->_dnsPort)
- $port = ":" . $this->_dnsPort;
- curl_setopt($ch, CURLOPT_URL, $server .$port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO');
- $data = curl_exec($ch);
- if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
- curl_close($ch);
- $this->_checkStatus($data);
- break;
case 'dyndns-static':
+ case 'dyndns-custom':
$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);
@@ -203,29 +189,12 @@
$server = $this->_dnsServer;
if($this->_dnsPort)
$port = ":" . $this->_dnsPort;
- curl_setopt($ch, CURLOPT_URL, $server.$port.'?system=statdns&hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP.'&wildcard='.$this->_dnsWildcard.'&mx='.$this->_dnsMX.'&backmx=NO');
+ curl_setopt($ch, CURLOPT_URL, $server .$port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO');
$data = curl_exec($ch);
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
curl_close($ch);
$this->_checkStatus($data);
break;
- case 'dyndns-custom':
- $needsIP = FALSE;
- 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://members.dyndns.org/nic/update";
- $port = "";
- if($this->_dnsServer)
- $server = $this->_dnsServer;
- if($this->_dnsPort)
- $port = ":" . $this->_dnsPort;
- curl_setopt($ch, CURLOPT_URL, $server.$port.'?system=custom&hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP.'&wildcard='.$this->_dnsWildcard.'&mx='.$this->_dnsMX.'&backmx=NO');
- $data = curl_exec($ch);
- if (@curl_error($ch)) log_error("Curl errror occured: " . curl_error($ch));
- curl_close($ch);
- $this->_checkStatus($data);
- break;
case 'dhs':
$needsIP = TRUE;
$post_data['hostscmd'] = 'edit';
@@ -403,7 +372,6 @@
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);
@@ -896,6 +864,7 @@
log_error("DynDns: _checkIP() starting.");
$ip_address = find_interface_ip($this->_if);
+ $this->_ifIP = $ip_address;
if (is_private_ip($ip_address)) {
$hosttocheck = "checkip.dyndns.org";
$checkip = gethostbyname($hosttocheck);
OpenPOWER on IntegriCloud