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:
epgdatacapbon 2016-01-11 21:29:17 +09:00
parent b64f9c7fe7
commit eeb0bb586d

View file

@ -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),
},
@ -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.
@ -4529,8 +4531,10 @@ sub nic_mydns_update {
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;
my $reply;
if ($config{$h}{'directip'}) {
$url = "http://$config{$h}{'server'}/directip.html";
$url .= "?MID=";
$url .= $config{$h}{'login'};
@ -4538,31 +4542,33 @@ sub nic_mydns_update {
$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');
if ($config{$h}{'directip'}) {
if ($reply =~ /login_status.*\n.*\n(.+)\s*<BR>/i) {
warning("REPLIED: %s", $1);
}
}
failed("updating %s: Invalid reply.", $h);
}
}