Revision c5e1ce90
Added by robjarsen about 7 years ago
src/etc/inc/dyndns.class | ||
---|---|---|
46 | 46 |
* - DNS-O-Matic (dnsomatic.com) |
47 | 47 |
* - Custom DDNS (any URL) |
48 | 48 |
* - Custom DDNS IPv6 (any URL) |
49 |
* - CloudFlare (www.cloudflare.com)
|
|
50 |
* - CloudFlare IPv6 (www.cloudflare.com)
|
|
49 |
* - Cloudflare (www.cloudflare.com)
|
|
50 |
* - Cloudflare IPv6 (www.cloudflare.com)
|
|
51 | 51 |
* - Eurodns (eurodns.com) |
52 | 52 |
* - GratisDNS (gratisdns.dk) |
53 | 53 |
* - City Network (citynetwork.se) |
... | ... | |
689 | 689 |
} |
690 | 690 |
curl_setopt($ch, CURLOPT_URL, $server .$port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO'); |
691 | 691 |
break; |
692 |
case 'route53':
|
|
692 |
case 'route53': |
|
693 | 693 |
require_once("r53.class"); |
694 | 694 |
$r53 = new Route53($this->_dnsUser, $this->_dnsPass); |
695 | 695 |
$apiurl = $r53->getApiUrl($this->_dnsZoneID); |
... | ... | |
706 | 706 |
curl_setopt($ch, CURLOPT_URL, $apiurl); |
707 | 707 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlreq); |
708 | 708 |
break; |
709 |
case 'route53-v6':
|
|
709 |
case 'route53-v6': |
|
710 | 710 |
require_once("r53.class"); |
711 | 711 |
$r53 = new Route53($this->_dnsUser, $this->_dnsPass); |
712 | 712 |
$apiurl = $r53->getApiUrl($this->_dnsZoneID); |
... | ... | |
1009 | 1009 |
@curl_close($ch); |
1010 | 1010 |
} |
1011 | 1011 |
} |
1012 |
|
|
1012 |
|
|
1013 | 1013 |
/** |
1014 | 1014 |
* Private Function (added 23 Feb 17) |
1015 | 1015 |
* Send Removal To Selected Service. |
1016 |
*
|
|
1016 |
* |
|
1017 | 1017 |
* Some services do not perform an inplace upgrade. If they do not then the solution |
1018 | 1018 |
* is to remove the existing record and add a new record. |
1019 |
*
|
|
1019 |
* |
|
1020 | 1020 |
* @param unknown $existing_ip If required, an existing IP address for the record. |
1021 | 1021 |
*/ |
1022 | 1022 |
function _remove($existing_ip = NULL) { |
... | ... | |
1024 | 1024 |
if ($this->_dnsVerboseLog) { |
1025 | 1025 |
log_error(sprintf(gettext('Dynamic DNS %1$s (%2$s): _remove() starting.'), $this->_dnsService, $this->_FQDN)); |
1026 | 1026 |
} |
1027 |
|
|
1027 |
|
|
1028 | 1028 |
if (strstr($this->_dnsRequestIf, "_vip")) { |
1029 | 1029 |
$parentif = get_configured_vip_interface($this->_dnsRequestIf); |
1030 | 1030 |
$realparentif = convert_friendly_interface_to_real_interface_name($parentif); |
1031 | 1031 |
} else { |
1032 | 1032 |
$realparentif = $this->_dnsRequestIf; |
1033 | 1033 |
} |
1034 |
|
|
1034 |
|
|
1035 | 1035 |
$ch = curl_init(); |
1036 |
|
|
1036 |
|
|
1037 | 1037 |
if ($this->_useIPv6 == false) { |
1038 | 1038 |
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
1039 | 1039 |
} |
1040 |
|
|
1040 |
|
|
1041 | 1041 |
curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent); |
1042 | 1042 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
1043 | 1043 |
curl_setopt($ch, CURLOPT_INTERFACE, 'if!' . $realparentif); |
1044 | 1044 |
curl_setopt($ch, CURLOPT_TIMEOUT, 120); // Completely empirical |
1045 |
|
|
1045 |
|
|
1046 | 1046 |
switch ($this->_dnsService) { |
1047 | 1047 |
case 'dreamhost': |
1048 | 1048 |
case 'dreamhost-v6': |
... | ... | |
1079 | 1079 |
@curl_close($ch); |
1080 | 1080 |
} |
1081 | 1081 |
} |
1082 |
|
|
1082 |
|
|
1083 | 1083 |
/** |
1084 | 1084 |
* Private Function (added 23 Feb 17) |
1085 | 1085 |
* Retrieves current DNS records from an external API source. |
1086 |
*
|
|
1087 |
* Some services cannot perform new operations without the caller
|
|
1088 |
* providing existing record information.
|
|
1086 |
* |
|
1087 |
* Some services cannot perform new operations without the caller |
|
1088 |
* providing existing record information. |
|
1089 | 1089 |
*/ |
1090 | 1090 |
function _lookup_current() { |
1091 | 1091 |
$lookup_allowed = false; |
1092 | 1092 |
if ($this->_dnsVerboseLog) { |
1093 | 1093 |
log_error(sprintf(gettext('Dynamic DNS %1$s (%2$s): _listCurrent() starting.'), $this->_dnsService, $this->_FQDN)); |
1094 | 1094 |
} |
1095 |
|
|
1095 |
|
|
1096 | 1096 |
if (strstr($this->_dnsRequestIf, "_vip")) { |
1097 | 1097 |
$parentif = get_configured_vip_interface($this->_dnsRequestIf); |
1098 | 1098 |
$realparentif = convert_friendly_interface_to_real_interface_name($parentif); |
1099 | 1099 |
} else { |
1100 | 1100 |
$realparentif = $this->_dnsRequestIf; |
1101 | 1101 |
} |
1102 |
|
|
1102 |
|
|
1103 | 1103 |
$ch = curl_init(); |
1104 |
|
|
1104 |
|
|
1105 | 1105 |
if ($this->_useIPv6 == false) { |
1106 | 1106 |
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
1107 | 1107 |
} |
1108 |
|
|
1108 |
|
|
1109 | 1109 |
curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent); |
1110 | 1110 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
1111 | 1111 |
curl_setopt($ch, CURLOPT_INTERFACE, 'if!' . $realparentif); |
1112 | 1112 |
curl_setopt($ch, CURLOPT_TIMEOUT, 120); // Completely empirical |
1113 |
|
|
1113 |
|
|
1114 | 1114 |
switch ($this->_dnsService) { |
1115 | 1115 |
case 'dreamhost': |
1116 | 1116 |
case 'dreamhost-v6': |
... | ... | |
1145 | 1145 |
} |
1146 | 1146 |
|
1147 | 1147 |
/* |
1148 |
* Private Function (added 23 Feb 17)
|
|
1148 |
* Private Function (added 23 Feb 17) |
|
1149 | 1149 |
* Retrieve Lookup Status from the provided data and/or header |
1150 | 1150 |
*/ |
1151 | 1151 |
function _checkLookupStatus($ch, $data, $header) { |
... | ... | |
1172 | 1172 |
return; |
1173 | 1173 |
} else { |
1174 | 1174 |
foreach($result["data"] as $key => $row) { |
1175 |
if($row["record"] == $this->_dnsHost &&
|
|
1175 |
if($row["record"] == $this->_dnsHost && |
|
1176 | 1176 |
(($row["type"] == "A" && !$this->_useIPv6) |
1177 | 1177 |
|| ($row["type"] == "AAAA" && $this->_useIPv6) |
1178 | 1178 |
)) { |
... | ... | |
1862 | 1862 |
$status = $status_intro . $error_str . gettext("Result did not match."); |
1863 | 1863 |
} else if (preg_match("/\s401\sUnauthorized/i", $header)) { |
1864 | 1864 |
$status = $status_intro . $error_str . gettext("Invalid username or password"); |
1865 |
}
|
|
1865 |
} |
|
1866 | 1866 |
else { |
1867 | 1867 |
$status = $status_intro . "(" . gettext("Unknown Response") . ")"; |
1868 | 1868 |
log_error($status_intro . gettext("PAYLOAD:") . " " . $header.$data); |
Also available in: Unified diff
Change CloudFlare to Cloudflare
This commit also includes misc. whitespace removal on the affected files.