From 290c9cf89b07f4d873bc098f2160ae6008b4bab0 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Mon, 14 Oct 2013 19:07:18 +0200 Subject: [PATCH] DDNS: Add support for udmedia.de. 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 | 2 ++ src/scripts/setddns.pl | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/html/cgi-bin/ddns.cgi b/html/cgi-bin/ddns.cgi index 88847a050..553d5d7c6 100644 --- a/html/cgi-bin/ddns.cgi +++ b/html/cgi-bin/ddns.cgi @@ -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 <strato.com + $Lang::tr{'hostname'}: * diff --git a/src/scripts/setddns.pl b/src/scripts/setddns.pl index f943ac83e..12c0f1df5 100644 --- a/src/scripts/setddns.pl +++ b/src/scripts/setddns.pl @@ -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 { -- 2.39.2