dnsexit2: Fix when provided with a zone and a non-identical hostname
Trim the zone from the hostname in the request to fix issue.
This commit is contained in:
parent
ec2d5f7f69
commit
216741c9ce
3 changed files with 20 additions and 16 deletions
|
@ -75,6 +75,8 @@ repository history](https://github.com/ddclient/ddclient/commits/master).
|
||||||
[#667](https://github.com/ddclient/ddclient/pull/667)
|
[#667](https://github.com/ddclient/ddclient/pull/667)
|
||||||
* Fixed unnecessary repeated updates for some services.
|
* Fixed unnecessary repeated updates for some services.
|
||||||
[#670](https://github.com/ddclient/ddclient/pull/670)
|
[#670](https://github.com/ddclient/ddclient/pull/670)
|
||||||
|
* Fixed DNSExit provider when configured with a zone and non-identical
|
||||||
|
hostname. [#673](https://github.com/ddclient/ddclient/issues/673)
|
||||||
|
|
||||||
## 2023-11-23 v3.11.2
|
## 2023-11-23 v3.11.2
|
||||||
|
|
||||||
|
|
17
ddclient.in
17
ddclient.in
|
@ -4140,6 +4140,8 @@ o 'dnsexit2'
|
||||||
|
|
||||||
The 'dnsexit2' protocol is the updated protocol for the (free) dynamic hostname services
|
The 'dnsexit2' protocol is the updated protocol for the (free) dynamic hostname services
|
||||||
of 'DNSExit' (www.dnsexit.com). Their API is accepting JSON payload.
|
of 'DNSExit' (www.dnsexit.com). Their API is accepting JSON payload.
|
||||||
|
Note that we only update the record, it must already exist in the DNSExit system
|
||||||
|
(A and/or AAAA records where applicable).
|
||||||
|
|
||||||
Configuration variables applicable to the 'dnsexit2' protocol are:
|
Configuration variables applicable to the 'dnsexit2' protocol are:
|
||||||
protocol=dnsexit2 ##
|
protocol=dnsexit2 ##
|
||||||
|
@ -4173,10 +4175,19 @@ EoEXAMPLE
|
||||||
######################################################################
|
######################################################################
|
||||||
sub nic_dnsexit2_update {
|
sub nic_dnsexit2_update {
|
||||||
debug("\nnic_dnsexit2_update -------------------");
|
debug("\nnic_dnsexit2_update -------------------");
|
||||||
|
# The DNSExit API does not support updating hosts with different zones at the same time,
|
||||||
# The DNSExit API does not support updating multiple hosts at a time.
|
# handling update per host.
|
||||||
for my $h (@_) {
|
for my $h (@_) {
|
||||||
$config{$h}{'zone'} //= $h;
|
$config{$h}{'zone'} //= $h;
|
||||||
|
my $name = $h;
|
||||||
|
# Remove the zone suffix from $name. If the zone eq $name, $name can be left alone or
|
||||||
|
# set to the empty string; both have identical semantics. For consistency, always
|
||||||
|
# remove the zone even if it means $name becomes the empty string.
|
||||||
|
if ($name =~ s/(?:^|\.)\Q$config{$h}{'zone'}\E$//) {
|
||||||
|
# The zone was successfully trimmed from $name.
|
||||||
|
} else {
|
||||||
|
fatal("Hostname %s does not end with the zone %s", $h, $config{$h}{'zone'});
|
||||||
|
}
|
||||||
# The IPv4 and IPv6 addresses must be updated together in a single API call.
|
# The IPv4 and IPv6 addresses must be updated together in a single API call.
|
||||||
my %ips;
|
my %ips;
|
||||||
my @updates;
|
my @updates;
|
||||||
|
@ -4186,7 +4197,7 @@ sub nic_dnsexit2_update {
|
||||||
info("Going to update IPv%s address to %s for %s.", $ipv, $ip, $h);
|
info("Going to update IPv%s address to %s for %s.", $ipv, $ip, $h);
|
||||||
$config{$h}{"status-ipv$ipv"} = 'failed';
|
$config{$h}{"status-ipv$ipv"} = 'failed';
|
||||||
push(@updates, {
|
push(@updates, {
|
||||||
name => $h,
|
name => $name,
|
||||||
type => ($ipv eq '6') ? 'AAAA' : 'A',
|
type => ($ipv eq '6') ? 'AAAA' : 'A',
|
||||||
content => $ip,
|
content => $ip,
|
||||||
ttl => $config{$h}{'ttl'},
|
ttl => $config{$h}{'ttl'},
|
||||||
|
|
|
@ -104,10 +104,7 @@ subtest 'Testing nic_dnsexit2_update' => sub {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
TODO: {
|
|
||||||
local $TODO = "https://github.com/ddclient/ddclient/issues/673";
|
|
||||||
is_deeply($data, $expected_data, 'Data is correct');
|
is_deeply($data, $expected_data, 'Data is correct');
|
||||||
}
|
|
||||||
reset_test_data();
|
reset_test_data();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -139,10 +136,7 @@ subtest 'Testing nic_dnsexit2_update without a zone set' => sub {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
TODO: {
|
|
||||||
local $TODO = "https://github.com/ddclient/ddclient/issues/673";
|
|
||||||
is_deeply($data, $expected_data, 'Data is correct');
|
is_deeply($data, $expected_data, 'Data is correct');
|
||||||
}
|
|
||||||
reset_test_data($ua);
|
reset_test_data($ua);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -200,12 +194,9 @@ subtest 'Testing nic_dnsexit2_update with two hostnames, one with a zone and one
|
||||||
@requests = get_requests();
|
@requests = get_requests();
|
||||||
for my $i (0..1) {
|
for my $i (0..1) {
|
||||||
my $data = decode_and_sort_array($requests[$i]->{content});
|
my $data = decode_and_sort_array($requests[$i]->{content});
|
||||||
TODO: {
|
|
||||||
local $TODO = "https://github.com/ddclient/ddclient/issues/673";
|
|
||||||
is_deeply($data, $expected_data1, 'Data is correct for call host1') if $i == 0;
|
is_deeply($data, $expected_data1, 'Data is correct for call host1') if $i == 0;
|
||||||
is_deeply($data, $expected_data2, 'Data is correct for call host2') if $i == 1;
|
is_deeply($data, $expected_data2, 'Data is correct for call host2') if $i == 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
reset_test_data();
|
reset_test_data();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue