From: Andrew Bellows Date: Sun, 21 Aug 2011 09:05:02 +0000 (+0200) Subject: ddns: Add support for namecheap provider. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff6f02953662fac69250177bebdfdc8e1c571fea;p=people%2Fteissler%2Fipfire-2.x.git ddns: Add support for namecheap provider. --- diff --git a/html/cgi-bin/ddns.cgi b/html/cgi-bin/ddns.cgi index f7ae56852..445354247 100644 --- a/html/cgi-bin/ddns.cgi +++ b/html/cgi-bin/ddns.cgi @@ -139,11 +139,13 @@ if ($settings{'ACTION'} eq $Lang::tr{'add'}) { } # Permit an empty HOSTNAME for the nsupdate, regfish, dyndns, enom, ovh, zoneedit, no-ip, easydns + #and namecheap unless ($settings{'SERVICE'} eq 'zoneedit.com' || $settings{'SERVICE'} eq 'nsupdate' || $settings{'SERVICE'} eq 'dyndns-custom'|| $settings{'SERVICE'} eq 'regfish.com' || $settings{'SERVICE'} eq 'enom.com' || $settings{'SERVICE'} eq 'dnspark.com' || $settings{'SERVICE'} eq 'ovh.com' || $settings{'HOSTNAME'} ne '' || - $settings{'SERVICE'} eq 'no-ip.com' || $settings{'SERVICE'} eq 'easydns.com' ) { + $settings{'SERVICE'} eq 'no-ip.com' || $settings{'SERVICE'} eq 'easydns.com' || + $settings{'SERVICE'} eq 'namecheap.com' ) { $errormessage = $Lang::tr{'hostname not set'}; } unless ($settings{'HOSTNAME'} eq '' || $settings{'HOSTNAME'} =~ /^[a-zA-Z_0-9-]+$/) { @@ -243,6 +245,7 @@ $checked{'SERVICE'}{'easydns.com'} = ''; $checked{'SERVICE'}{'enom.com'} = ''; $checked{'SERVICE'}{'freedns.afraid.org'} = ''; $checked{'SERVICE'}{'hn.org'} = ''; +$checked{'SERVICE'}{'namecheap.com'} = ''; $checked{'SERVICE'}{'no-ip.com'} = ''; $checked{'SERVICE'}{'nsupdate'} = ''; $checked{'SERVICE'}{'ovh.com'} = ''; @@ -336,6 +339,7 @@ print <enom.com + diff --git a/src/scripts/setddns.pl b/src/scripts/setddns.pl index 2c7c947f5..f66b841d7 100644 --- a/src/scripts/setddns.pl +++ b/src/scripts/setddns.pl @@ -515,6 +515,36 @@ if ($ip ne $ipcache) { &General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure (could not connect to server)"); } } + #namecheap test + elsif ($settings{'SERVICE'} eq 'namecheap') { + # 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'} ); + } + + my ($out, $response) = Net::SSLeay::get_https( 'dynamicdns.park-your-domain.com', + 443, + "/update?host=$settings{'HOSTNAME'}&domain=$settings{'DOMAIN'}&password=$settings{'PASSWORD'}&ip=$ip", + Net::SSLeay::make_headers('User-Agent' => 'IPFire' ) + ); + #Valid responses from service are: + # wait confirmation!! + if ($response =~ m%HTTP/1\.. 200 OK%) { + if ( $out !~ m/0<\/ErrCount>/ ) { + $out =~ m/(.*)<\/Err1>/; + &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : failure ($1)"); + } else { + &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : success"); + $success++; + } + } else { + &General::log("Dynamic DNS ip-update for $settings{'HOSTNAME'}.$settings{'DOMAIN'} : failure (could not connect to server)"); + } + } + #end namecheap test elsif ($settings{'SERVICE'} eq 'dynu') { # use proxy ? my %proxysettings;