Added patch for dtdns-support (#39)
git-svn-id: svn+ssh://svn.code.sf.net/p/ddclient/code/trunk@125 3873ddee-7413-0410-b6c4-c2c57c1ab35a
This commit is contained in:
parent
e0a1283b10
commit
1b4c31b82e
2 changed files with 104 additions and 0 deletions
96
ddclient
96
ddclient
|
@ -420,6 +420,10 @@ my %variables = (
|
|||
'zoneedit-service-common-defaults' => {
|
||||
'zone' => setv(T_OFQDN, 0, 0, 1, undef, undef),
|
||||
},
|
||||
'dtdns-common-defaults' => {
|
||||
'login' => setv(T_LOGIN, 0, 0, 0, 'unused', undef),
|
||||
'client' => setv(T_STRING, 0, 1, 1, $program, undef),
|
||||
},
|
||||
);
|
||||
my %services = (
|
||||
'dyndns1' => {
|
||||
|
@ -545,6 +549,15 @@ my %services = (
|
|||
$variables{'service-common-defaults'},
|
||||
),
|
||||
},
|
||||
'dtdns' => {
|
||||
'updateable' => undef,
|
||||
'update' => \&nic_dtdns_update,
|
||||
'examples' => \&nic_dtdns_examples,
|
||||
'variables' => merge(
|
||||
$variables{'dtdns-common-defaults'},
|
||||
$variables{'service-common-defaults'},
|
||||
),
|
||||
},
|
||||
);
|
||||
$variables{'merged'} = merge($variables{'global-defaults'},
|
||||
$variables{'service-common-defaults'},
|
||||
|
@ -3559,6 +3572,89 @@ sub nic_freedns_update {
|
|||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
|
||||
######################################################################
|
||||
## nic_dtdns_examples
|
||||
######################################################################
|
||||
sub nic_dtdns_examples {
|
||||
return <<EoEXAMPLE;
|
||||
o 'dtdns'
|
||||
|
||||
The 'dtdns' protocol is the protocol used by the dynamic hostname services
|
||||
of the 'DtDNS' dns services. This is currently used by the free
|
||||
dynamic DNS service offered by www.dtdns.com.
|
||||
|
||||
Configuration variables applicable to the 'dtdns' protocol are:
|
||||
protocol=dtdns ##
|
||||
server=www.fqdn.of.service ## defaults to www.dtdns.com
|
||||
password=service-password ## password registered with the service
|
||||
client=name_of_updater ## defaults to $program (10 chars max, no spaces)
|
||||
fully.qualified.host ## the host registered with the service.
|
||||
|
||||
Example ${program}.conf file entries:
|
||||
## single host update
|
||||
protocol=dtdns, \\
|
||||
password=my-dydns.za.net-password, \\
|
||||
client=ddclient \\
|
||||
myhost.dtdns.net
|
||||
|
||||
EoEXAMPLE
|
||||
}
|
||||
|
||||
######################################################################
|
||||
## nic_dtdns_update
|
||||
## by Achim Franke
|
||||
######################################################################
|
||||
sub nic_dtdns_update {
|
||||
debug("\nnic_dtdns_update -------------------");
|
||||
|
||||
## update each configured host
|
||||
foreach my $h (@_) {
|
||||
my $ip = delete $config{$h}{'wantip'};
|
||||
info("setting IP address to %s for %s", $ip, $h);
|
||||
verbose("UPDATE:","updating %s", $h);
|
||||
|
||||
# Set the URL that we're going to to update
|
||||
my $url;
|
||||
$url = "http://$config{$h}{'server'}/api/autodns.cfm";
|
||||
$url .= "?id=";
|
||||
$url .= $h;
|
||||
$url .= "&pw=";
|
||||
$url .= $config{$h}{'password'};
|
||||
$url .= "&ip=";
|
||||
$url .= $ip;
|
||||
$url .= "&client=";
|
||||
$url .= $config{$h}{'client'};
|
||||
|
||||
# Try to get URL
|
||||
my $reply = geturl(opt('proxy'), $url);
|
||||
|
||||
# No response, declare as failed
|
||||
if (!defined($reply) || !$reply) {
|
||||
failed("updating %s: Could not connect to %s.", $h, $config{$h}{'server'});
|
||||
last;
|
||||
}
|
||||
last if !header_ok($h, $reply);
|
||||
|
||||
# Response found, just declare as success (this is ugly, we need more error checking)
|
||||
if ($reply =~ /now\spoints\sto/)
|
||||
{
|
||||
$config{$h}{'ip'} = $ip;
|
||||
$config{$h}{'mtime'} = $now;
|
||||
$config{$h}{'status'} = 'good';
|
||||
success("updating %s: good: IP address set to %s", $h, $ip);
|
||||
}
|
||||
else
|
||||
{
|
||||
my @reply = split /\n/, $reply;
|
||||
my $returned = pop(@reply);
|
||||
$config{$h}{'status'} = 'failed';
|
||||
failed("updating %s: Server said: '$returned'", $h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# vim: ai ts=4 sw=4 tw=78 :
|
||||
|
||||
|
|
|
@ -178,3 +178,11 @@ ssl=yes # use ssl-support. Works with
|
|||
# password=my-loopia.se-password
|
||||
# my.domain.tld,other.domain.tld
|
||||
|
||||
##
|
||||
## DtDNS (www.dtdns.com)
|
||||
##
|
||||
# protocol=dtdns,
|
||||
# server=www.dtdns.com,
|
||||
# client=ddclient,
|
||||
# password=my-dtdns.com-password
|
||||
# myhost.dtdns.net, otherhost.dtdns.net
|
||||
|
|
Loading…
Reference in a new issue