updated nic_duckdns_update to account for extra lines in duckdns reply

This commit is contained in:
drinn 2023-01-28 09:48:51 -06:00
parent e910204b3d
commit d35d62f3e7

View file

@ -6559,17 +6559,29 @@ sub nic_duckdns_update {
next if !header_ok($h, $reply);
my @reply = split /\n/, $reply;
my $returned = pop(@reply);
if ($returned =~ /OK/) {
my $state = 'noresult';
my $line = '';
foreach $line (@reply) {
if ($line eq 'OK') {
$config{$h}{'ip'} = $ip;
$config{$h}{'mtime'} = $now;
$config{$h}{'status'} = 'good';
$state = 'result';
success("updating %s: good: IP address set to %s", $h, $ip);
} else {
} elsif ($line eq 'KO') {
$config{$h}{'status'} = 'failed';
failed("updating %s: Server said: '%s'", $h, $returned);
$state = 'result';
failed("updating %s: Server said: '%s'", $h, $line);
}
}
if ($state eq 'noresult') {
failed("updating %s: Server said: '%s'", $h, $line);
}
}
}
######################################################################