Project

General

Profile

Actions

Bug #12754

closed

Google Domains Dynamic DNS responses are not parsed properly

Added by Daniel Pontillo almost 3 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Viktor Gurov
Category:
Dynamic DNS
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
22.05
Release Notes:
Default
Affected Version:
2.5.2
Affected Architecture:
amd64

Description

When using Google Domains with the Dynamic DNS feature, it fails for Unknown Response. This is due to Google requiring POST requests to be of type Content-Type: application/x-www-form-urlencoded, and can be fixed by using URL encoded post parametrs.

/services_dyndns_edit.php: phpDynDNS (<domain>): (Unknown Response)

Here is code to fix it in /etc/inc/dyndns.class:

case 'googledomains':
  $needsIP = FALSE;
  $post_data['username:password'] = $this->_dnsUser . ':' . $this->_dnsPass;
  $post_data['hostname'] = $this->_dnsHost;
  $post_data['myip'] = $this->_dnsIP;
  $post_data['offline'] = 'no';
  $server = "https://domains.google.com/nic/update";
  $port = "";
  curl_setopt($ch, CURLOPT_URL, 'https://domains.google.com/nic/update');
  curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
  curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
  curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent);
  curl_setopt($ch, CURLOPT_POST,1);
  break;

To get around the issue, the main thing is changing the CURLOPT_POSTFIELDS value to be http_build_query($post_data) instead of just the $post_data Array. Doing this will force PHP's curl lib to use Content-Type: application/x-www-form-urlencoded... this fixes the issue with P3P and post requests. I threw in the USERAGENT also, since Google says we should use it.

Actions

Also available in: Atom PDF