Fix DigitalOcean DynDNS client

Fixes the check on the return value since it's been updated to use
HTTP/2 syntax. Also adds logic to allow using `@` to denote updating the
root domain A record as well.
This commit is contained in:
Grant Sheehan 2018-12-05 22:33:11 -07:00
parent f5f79fcc24
commit 5878d52994
No known key found for this signature in database
GPG Key ID: 449EB51E5F681503
2 changed files with 9 additions and 3 deletions

View File

@ -998,7 +998,9 @@
$output->domain_records = array();
}
foreach($output->domain_records as $dnsRecord) {
if ($this->_dnsHost == $dnsRecord->name) {
// NS records are named @ in DO's API, so check type as well
// https://redmine.pfsense.org/issues/9171
if ($this->_dnsHost == $dnsRecord->name && $dnsRecord->type == 'A') {
$recordID = $dnsRecord->id;
break;
}
@ -1845,7 +1847,9 @@
}
break;
case 'digitalocean':
if (preg_match("/\s200\sOK/i", $header)) {
// Creating new records returns an HTTP 201, updating existing records get 200
// https://redmine.pfsense.org/issues/9171
if (preg_match("/HTTP\/2\s20[0,1]/i", $header)) {
$status = $status_intro . $success_str . gettext("IP Address Updated Successfully!");
$successful_update = true;
} else {

View File

@ -113,6 +113,8 @@ if ($_POST['save'] || $_POST['force']) {
$host_to_check = $_POST['domainname'];
} elseif ((($pconfig['type'] == "godaddy") || ($pconfig['type'] == "godaddy-v6")) && ($_POST['host'] == '@.' || $_POST['host'] == '@')) {
$host_to_check = $_POST['domainname'];
} elseif (($pconfig['type'] == "digitalocean") && ($_POST['host'] == '@.' || $_POST['host'] == '@')) {
$host_to_check = $_POST['domainname'];
} else {
$host_to_check = $_POST['host'];
@ -300,7 +302,7 @@ $group->setHelp('Enter the complete fully qualified domain name. Example: myhost
'GleSYS: Enter the record ID.%1$s' .
'DNSimple: Enter only the domain name.%1$s' .
'Namecheap, Cloudflare, GratisDNS, Hover, ClouDNS, GoDaddy: Enter the hostname and the domain separately, with the domain being the domain or subdomain zone being handled by the provider.%1$s' .
'Cloudflare: Enter @ as the hostname to indicate an empty field.', '<br />');
'Cloudflare and DigitalOcean: Enter @ as the hostname to indicate an empty field.', '<br />');
$section->add($group);