]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
DDNS: Add support for udmedia.de.
authorStefan Schantl <stefan.schantl@ipfire.org>
Mon, 14 Oct 2013 17:07:18 +0000 (19:07 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Mon, 14 Oct 2013 17:07:18 +0000 (19:07 +0200)
This commit adds support for the dynamic dns service provider udmedia.de and was requested by a user on the forum.

Details can be found here: http://forum.ipfire.org/index.php?topic=9097.0

Fixes #10432.

html/cgi-bin/ddns.cgi
src/scripts/setddns.pl

index 88847a050b04171d9b191aca28e4a1f18db25bd0..553d5d7c6272e54926fe0061f30066ea5f25db1e 100644 (file)
@@ -256,6 +256,7 @@ $checked{'SERVICE'}{'selfhost.de'} = '';
 $checked{'SERVICE'}{'strato.com'} = '';
 $checked{'SERVICE'}{'tzo.com'} = '';
 $checked{'SERVICE'}{'zoneedit.com'} = '';
+$checked{'SERVICE'}{'udmedia.de'} = '';
 $checked{'SERVICE'}{$settings{'SERVICE'}} = "selected='selected'";
 
 $checked{'BEHINDROUTER'}{'RED_IP'} = '';
@@ -352,6 +353,7 @@ print <<END
     <option $checked{'SERVICE'}{'strato.com'}>strato.com</option>
 <!--    <option $checked{'SERVICE'}{'tzo.com'}>tzo.com</option>        comment this service out until a working fix is developed -->
     <option $checked{'SERVICE'}{'zoneedit.com'}>zoneedit.com</option>
+    <option $checked{'SERVICE'}{'udmedia.de'}>udmedia.de</option>
     </select></td>
     <td width='20%' class='base'>$Lang::tr{'hostname'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
     <td width='30%'><input type='text' name='HOSTNAME' value='$settings{'HOSTNAME'}' /></td>
index f943ac83e0dae25e89d8db161e45e6fbf4807725..12c0f1df5f19853160f5c212bb91c15cd8889ec1 100644 (file)
@@ -637,7 +637,42 @@ if ($ip ne $ipcache) {
                            } else {
                                &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure (could not connect to server)");
                            }
-                       } else {
+                       }
+                       elsif ($settings{'SERVICE'} eq 'udmedia.de') {
+                           # use proxy ?
+                           my %proxysettings;
+                           &General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
+                           if ($_=$proxysettings{'UPSTREAM_PROXY'}) {
+                               my ($peer, $peerport) = (/^(?:[a-zA-Z ]+\:\/\/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/.*?)?$/);
+                               Net::SSLeay::set_proxy($peer,$peerport,$proxysettings{'UPSTREAM_USER'},$proxysettings{'UPSTREAM_PASSWORD'} );
+                           }
+
+                           if ($settings{'HOSTNAME'} eq '') {
+                               $settings{'HOSTDOMAIN'} = $settings{'DOMAIN'};
+                           } else {
+                               $settings{'HOSTDOMAIN'} = "$settings{'HOSTNAME'}.$settings{'DOMAIN'}";
+                           }
+
+                           my ($out, $response) = Net::SSLeay::get_https( 'www.udmedia.de',
+                                                                           443,
+                                                                           "/nic/update?myip=$ip&username=$settings{'HOSTDOMAIN'}&password=$settings{'PASSWORD'}",
+                                                                           Net::SSLeay::make_headers('User-Agent' => 'IPFire',
+                                                                                                     'Authorization' => 'Basic ' . encode_base64("$settings{'LOGIN'}:$settings{'PASSWORD'}")) );
+
+                           # Valid response are 'ok'   'nochange'
+                           if ($response =~ m%HTTP/1\.. 200 OK%) {
+                               if ( $out !~ m/^(ok|nochg)/ ) {
+                                   $out =~ s/\n/ /g;
+                                   &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure ($out)");
+                               } else {
+                                   &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : success");
+                                   $success++;
+                               }
+                           } else {
+                               &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure (could not connect to server, check your credentials---$out-$response--)");
+                           }
+                       }
+                       else {
                                if ($settings{'WILDCARDS'} eq 'on') {
                                    $settings{'WILDCARDS'} = '-w';
                                } else {