Project

General

Profile

Actions

Bug #12754

open

Google Domains Dynamic DNS responses are not parsed properly

Added by Daniel Pontillo 4 months ago. Updated about 2 months ago.

Status:
Feedback
Priority:
Normal
Assignee:
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 #2

Updated by Jim Pingle 4 months ago

  • Status changed from New to Pull Request Review
  • Target version set to 2.7.0
  • Plus Target Version set to 22.05
Actions #3

Updated by Dakota Hourie 3 months ago

Thank you for this. I edited my /etc/inc/dyndns.class file with your code snippet and that resolved my same issue.

Actions #4

Updated by Viktor Gurov 3 months ago

  • Status changed from Pull Request Review to Feedback
  • % Done changed from 0 to 100
Actions #5

Updated by Jim Pingle about 2 months ago

  • Subject changed from DynDNS fails with Unknown Response when uploading IP to Google Domains to Google Domains Dynamic DNS responses are not parsed properly

Updating subject for release notes.

Actions

Also available in: Atom PDF