Bug #12754
openGoogle Domains Dynamic DNS responses are not parsed properly
100%
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.
Updated by Viktor Gurov 4 months ago
- Assignee set to Viktor Gurov
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
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.
Updated by Viktor Gurov 3 months ago
- Status changed from Pull Request Review to Feedback
- % Done changed from 0 to 100
Applied in changeset b5360f49fb3c1fdc36ebf13c20b68d4ff1e15fe6.
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.