Made autodetect explicit for updates (no more implicit autodetect)

Changed the behaviour of the update command so that it would not just 
pick the remote address if no ip parameter was provided.

To autodetect the IP address it is now mandatory to pass value auto (so 
ip=auto) for the ipv4addr or ipv6addr. This also allows to specify which 
address should be autodetected and have a static address passed for ipv4 
and have the ipv6 address autodetected for multi-network systems (also 
closes #6)
This commit is contained in:
2019-08-01 15:55:50 +02:00
parent 47a697d458
commit de0f57806c

View File

@@ -221,11 +221,14 @@ sub handle_update($$$$$$) {
} else {
# Get ipv4, and ipv6 parameters
my $remote_addr = $cgi->remote_addr;
my $ipv4addr = $cgi->param('ipv4addr')
|| $cgi->param('ip')
|| (is_ipv4($remote_addr) ? $remote_addr : undef);
my $ipv6addr = $cgi->param('ipv6addr')
|| (! $ipv4addr and is_ipv6($remote_addr)) ? $remote_addr : undef;
my $ipv4addr = $cgi->param('ipv4addr') || $cgi->param('ip');
if ($ipv4addr == 'auto') {
$ipv4addr = is_ipv4($remote_addr) ? $remote_addr : undef;
}
my $ipv6addr = $cgi->param('ipv6addr') || $cgi->param('ipv6');
if ($ipv6addr == 'auto') {
$ipv6addr = is_ipv6($remote_addr) ? $remote_addr : undef;
}
($statuscode, $statusmessage) =
DNS_Update($dnsdomain, $dnshost, $ipv4addr, $ipv6addr, $signer, $key, $debug);
}