MyDNS.JP: support for HTTP-BASIC
http://www.mydns.jp/?MENU=030 HTTP-BASIC(default): Let MyDNS.jp get the IP. HTTP-DIRECT(directip=yes): Use the IP specified by ddclient.
This commit is contained in:
parent
b64f9c7fe7
commit
eeb0bb586d
1 changed files with 30 additions and 24 deletions
54
ddclient
54
ddclient
|
|
@ -478,6 +478,7 @@ my %variables = (
|
|||
'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, 0, undef),
|
||||
},
|
||||
'mydns-common-defaults' => {
|
||||
'directip' => setv(T_BOOL, 0, 0, 1, 0, undef),
|
||||
'server' => setv(T_FQDNP, 1, 0, 1, 'www.mydns.jp', undef),
|
||||
'max-interval' => setv(T_DELAY, 0, 0, 1, interval('6d'), 0),
|
||||
},
|
||||
|
|
@ -678,7 +679,7 @@ my %services = (
|
|||
'updateable' => undef,
|
||||
'update' => \&nic_mydns_update,
|
||||
'examples' => \&nic_mydns_examples,
|
||||
'variables' => merge(
|
||||
'variables' => merge(
|
||||
$variables{'mydns-common-defaults'},
|
||||
$variables{'service-common-defaults'},
|
||||
),
|
||||
|
|
@ -4504,8 +4505,9 @@ The 'mydns' protocol is used by a free dynamic DNS service offered by www.mydns.
|
|||
|
||||
Configuration variables applicable to the 'mydns' protocol are:
|
||||
protocol=mydns ##
|
||||
server=fqdn.of.service ## defaults to www.mydns.jp
|
||||
login=service-login ## login name and password registered with the service
|
||||
directip=no|yes ## update the DNS record with a specified IP address.
|
||||
server=fqdn.of.service ## defaults to www.mydns.jp.
|
||||
login=service-login ## login name and password registered with the service.
|
||||
password=service-password ##
|
||||
fully.qualified.host ## the host registered with the service.
|
||||
|
||||
|
|
@ -4525,44 +4527,48 @@ sub nic_mydns_update {
|
|||
|
||||
## update each configured host
|
||||
foreach my $h (@_) {
|
||||
my $ip = delete $config{$h}{'wantip'};
|
||||
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
|
||||
## update the DNS record
|
||||
my $url;
|
||||
$url = "http://$config{$h}{'server'}/directip.html";
|
||||
$url .= "?MID=";
|
||||
$url .= $config{$h}{'login'};
|
||||
$url .= "&PWD=";
|
||||
$url .= $config{$h}{'password'};
|
||||
$url .= "&IPV4ADDR=";
|
||||
$url .= $ip;
|
||||
my $reply;
|
||||
if ($config{$h}{'directip'}) {
|
||||
$url = "http://$config{$h}{'server'}/directip.html";
|
||||
$url .= "?MID=";
|
||||
$url .= $config{$h}{'login'};
|
||||
$url .= "&PWD=";
|
||||
$url .= $config{$h}{'password'};
|
||||
$url .= "&IPV4ADDR=";
|
||||
$url .= $ip;
|
||||
$reply = geturl(opt('proxy'), $url);
|
||||
} else {
|
||||
$url = "http://$config{$h}{'server'}/login.html";
|
||||
$reply = geturl(opt('proxy'), $url, $config{$h}{'login'}, $config{$h}{'password'});
|
||||
}
|
||||
|
||||
# Try to get URL
|
||||
my $reply = geturl(opt('proxy'), $url);
|
||||
|
||||
# No response, declare as failed
|
||||
## 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, check the reply
|
||||
if ($reply =~ /login_status = 1/i)
|
||||
{
|
||||
## response found, check the result
|
||||
if ($reply =~ /login_status = 1/i) {
|
||||
$config{$h}{'ip'} = $ip;
|
||||
$config{$h}{'mtime'} = $now;
|
||||
$config{$h}{'status'} = 'good';
|
||||
success("updating %s: good: IP address set to %s", $h, $ip);
|
||||
}
|
||||
else
|
||||
{
|
||||
$reply =~ /login_status.*\n.*\n(.+)\s*<BR>/i;
|
||||
} else {
|
||||
$config{$h}{'status'} = 'failed';
|
||||
warning("SENT: %s", $url) unless opt('verbose');
|
||||
warning("REPLIED: %s", $1);
|
||||
if ($config{$h}{'directip'}) {
|
||||
if ($reply =~ /login_status.*\n.*\n(.+)\s*<BR>/i) {
|
||||
warning("REPLIED: %s", $1);
|
||||
}
|
||||
}
|
||||
failed("updating %s: Invalid reply.", $h);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue