]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
DDNS: Fix API call for the "Dynu" DDNS service
authorStefan Ferstl <st.ferstl@gmail.com>
Tue, 17 Jun 2014 09:22:21 +0000 (11:22 +0200)
committerStefan Ferstl <st.ferstl@gmail.com>
Tue, 17 Jun 2014 09:22:21 +0000 (11:22 +0200)
This affects the DDNS service "dynu.ca dyn.ee dynserv.(ca|org|net|com)".
DNS updates using this service were made using the URL http://dynserv.ca/ . However,
the domain dynserv.ca does not exist anymore. The Dynu service is now only reachable
via the dynu.com domain. This commit changes the API call according to Dynu's
specification on http://www.dynu.com/Default.aspx?page=dnsapi .

src/scripts/setddns.pl

index 5e77fce5c024a3f17ba4c892a94abfe95845e8c6..5a195650c691c34d14dd7625bd01077d4751457c 100644 (file)
@@ -632,23 +632,22 @@ if ($ip ne $ipcache) {
                                $settings{'HOSTDOMAIN'} = "$settings{'HOSTNAME'}.$settings{'DOMAIN'}";
                            }
 
-                           my ($out, $response) = Net::SSLeay::get_http(  'dynserv.ca',
-                                                                           80,
-                                                                           "/dyn/dynengine.cgi?func=set&name=$settings{'LOGIN'}&pass=$settings{'PASSWORD'}&ip=$ip&domain=$settings{'DOMAIN'}",
+                           my ($out, $response) = Net::SSLeay::get_https( 'api.dynu.com',
+                                                                           443,
+                                                                           "/nic/update?hostname=$settings{'HOSTDOMAIN'}&myip=$ip&username=$settings{'LOGIN'}&password=$settings{'PASSWORD'}",
                                                                            Net::SSLeay::make_headers('User-Agent' => 'IPFire' )
                                                                         );
-                           #Valid responses from service are:
-                           # 02 == Domain already exists, refreshing data for ... => xxx.xxx.xxx.xxx
-                           #
+                           # Valid responses are 'good xxx.xxx.xxx.xxx', 'nochg'
+                           # see http://www.dynu.com/Default.aspx?page=dnsapi for further details
                            if ($response =~ m%HTTP/1\.. 200 OK%) {
-                               if ( $out !~ m/Domain already exists, refreshing data for/ig ) {
+                               if ( $out !~ m/^(good|nochg)/ ) {
                                    &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure ($out)");
                                } else {
-                                   &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : success");
+                                   &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : success ($out)");
                                    $success++;
                                }
                            } else {
-                               &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure (could not connect to server)");
+                               &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure (could not connect to server---$out-$response)");
                            }
                        }
                        elsif ($settings{'SERVICE'} eq 'udmedia') {