From e7ad0e8e6e9ecb5bbf4ef1a7669f741483fdad58 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 20 Jul 2024 02:13:13 -0400 Subject: [PATCH 01/12] easydns: Whitespace fixes --- ddclient.in | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/ddclient.in b/ddclient.in index 82a324c..45fa257 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4797,12 +4797,9 @@ sub nic_easydns_update { for my $h (@_) { my $ipv4 = delete $config{$h}{'wantipv4'}; my $ipv6 = delete $config{$h}{'wantipv6'}; - info("setting IP address to %s %s for %s", $ipv4, $ipv6, $h); verbose("UPDATE:", "updating %s", $h); - #'https://api.cp.easydns.com/dyn/generic.php?hostname=test.burry.ca&myip=10.20.30.40&wildcard=ON' - my $url; $url = "https://$config{$h}{'server'}$config{$h}{'script'}?"; $url .= "hostname=$h"; @@ -4813,12 +4810,10 @@ sub nic_easydns_update { $url .= $ipv6a } $url .= "&wildcard=" . ynu($config{$h}{'wildcard'}, 'ON', 'OFF', 'OFF') if defined $config{$h}{'wildcard'}; - if ($config{$h}{'mx'}) { $url .= "&mx=$config{$h}{'mx'}"; $url .= "&backmx=" . ynu($config{$h}{'backupmx'}, 'YES', 'NO'); } - my $reply = geturl( proxy => opt('proxy'), url => $url, @@ -4830,21 +4825,16 @@ sub nic_easydns_update { next; } next if !header_ok($h, $reply); - my @reply = split /\n/, $reply; my $state = 'header'; for my $line (@reply) { if ($state eq 'header') { $state = 'body'; - } elsif ($state eq 'body') { $state = 'results' if $line eq ''; - } elsif ($state =~ /^results/) { $state = 'results2'; - my ($status) = $line =~ /^(\S*)\b.*/; - $config{$h}{'status-ipv4'} = $status if $ipv4; $config{$h}{'status-ipv6'} = $status if $ipv6; if ($status eq 'NOERROR') { @@ -4852,21 +4842,17 @@ sub nic_easydns_update { $config{$h}{'ipv6'} = $ipv6; $config{$h}{'mtime'} = $now; success("updating %s: %s: IP address set to %s %s", $h, $status, $ipv4, $ipv6); - } elsif ($status =~ /TOOSOON/) { ## make sure we wait at least a little my ($wait, $units) = (5, 'm'); my ($sec, $scale) = ($wait, 1); - ($scale, $units) = (1, 'seconds') if $units eq 's'; ($scale, $units) = (60, 'minutes') if $units eq 'm'; ($scale, $units) = (60*60, 'hours') if $units eq 'h'; $config{$h}{'wtime'} = $now + $sec; warning("updating %s: %s: wait %d %s before further updates", $h, $status, $wait, $units); - } elsif (exists $errors{$status}) { failed("updating %s: %s: %s", $h, $line, $errors{$status}); - } else { failed("updating %s: unexpected status (%s)", $h, $line); } From 94c304601e8ecfeadf75c3930ee6f0f0e24a89f6 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 19 Jul 2024 19:21:25 -0400 Subject: [PATCH 02/12] easydns: Increase default `min-interval` to 10m --- ChangeLog.md | 3 +++ ddclient.in | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 9b0a001..02667c4 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -43,6 +43,9 @@ repository history](https://github.com/ddclient/ddclient/commits/master). [#709](https://github.com/ddclient/ddclient/pull/709) * The diagnostic `--geturl` command-line argument was removed. [#712](https://github.com/ddclient/ddclient/pull/712) + * `easydns`: The default value for `min-interval` was increased from 5m to 10m + to match easyDNS documentation. + [#713](https://github.com/ddclient/ddclient/pull/713) ### New features diff --git a/ddclient.in b/ddclient.in index 45fa257..a31daab 100755 --- a/ddclient.in +++ b/ddclient.in @@ -866,7 +866,9 @@ our %protocols = ( 'variables' => { %{$variables{'protocol-common-defaults'}}, 'backupmx' => setv(T_BOOL, 0, 1, 0, undef), - 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), + # From : "You need to wait at least 10 + # minutes between updates." + 'min-interval' => setv(T_DELAY, 0, 0, interval('10m'), 0), 'mx' => setv(T_OFQDN, 0, 1, undef, undef), 'server' => setv(T_FQDNP, 0, 0, 'api.cp.easydns.com', undef), 'script' => setv(T_STRING, 0, 1, '/dyn/generic.php', undef), From 7a2625b7a753227ba285da550d820517ed770658 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 20 Jul 2024 00:17:43 -0400 Subject: [PATCH 03/12] easydns: Refine log messages * Consistently use just the hostname as the log message prefix. * Delete redundant verbose log message. * Log IPv4 and IPv6 separately in case `$ipv4` or `$ipv6` is `undef`. * Don't log the full line when a known error result is returned. * For unknown results, don't wrap the line in parentheses. * Use string interpolation for readability. --- ddclient.in | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ddclient.in b/ddclient.in index a31daab..67d717e 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4799,8 +4799,8 @@ sub nic_easydns_update { for my $h (@_) { my $ipv4 = delete $config{$h}{'wantipv4'}; my $ipv6 = delete $config{$h}{'wantipv6'}; - info("setting IP address to %s %s for %s", $ipv4, $ipv6, $h); - verbose("UPDATE:", "updating %s", $h); + info("$h: setting IPv4 address to $ipv4") if $ipv4; + info("$h: setting IPv6 address to $ipv6") if $ipv6; #'https://api.cp.easydns.com/dyn/generic.php?hostname=test.burry.ca&myip=10.20.30.40&wildcard=ON' my $url; $url = "https://$config{$h}{'server'}$config{$h}{'script'}?"; @@ -4823,7 +4823,7 @@ sub nic_easydns_update { password => $config{$h}{'password'}, ) // ''; if ($reply eq '') { - failed("updating %s: Could not connect to %s.", $h, $config{$h}{'server'}); + failed("$h: Could not connect to $config{$h}{'server'}"); next; } next if !header_ok($h, $reply); @@ -4843,7 +4843,8 @@ sub nic_easydns_update { $config{$h}{'ipv4'} = $ipv4; $config{$h}{'ipv6'} = $ipv6; $config{$h}{'mtime'} = $now; - success("updating %s: %s: IP address set to %s %s", $h, $status, $ipv4, $ipv6); + success("$h: IPv4 address set to $ipv4") if $ipv4; + success("$h: IPv6 address set to $ipv6") if $ipv6; } elsif ($status =~ /TOOSOON/) { ## make sure we wait at least a little my ($wait, $units) = (5, 'm'); @@ -4852,17 +4853,16 @@ sub nic_easydns_update { ($scale, $units) = (60, 'minutes') if $units eq 'm'; ($scale, $units) = (60*60, 'hours') if $units eq 'h'; $config{$h}{'wtime'} = $now + $sec; - warning("updating %s: %s: wait %d %s before further updates", $h, $status, $wait, $units); + warning("$h: $status: wait $wait $units before further updates"); } elsif (exists $errors{$status}) { - failed("updating %s: %s: %s", $h, $line, $errors{$status}); + failed("$h: $status: $errors{$status}"); } else { - failed("updating %s: unexpected status (%s)", $h, $line); + failed("$h: unexpected result: $line"); } last; } } - failed("updating %s: Could not connect to %s.", $h, $config{$h}{'server'}) - if $state ne 'results2'; + failed("$h: Could not connect to $config{$h}{'server'}") if $state ne 'results2'; } } From 6992a3402846da2c8205c5df4df8411303b32956 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 20 Jul 2024 00:07:20 -0400 Subject: [PATCH 04/12] easydns: Simplify response processing --- ddclient.in | 61 +++++++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/ddclient.in b/ddclient.in index 67d717e..4f3fc4a 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4827,42 +4827,33 @@ sub nic_easydns_update { next; } next if !header_ok($h, $reply); - my @reply = split /\n/, $reply; - my $state = 'header'; - for my $line (@reply) { - if ($state eq 'header') { - $state = 'body'; - } elsif ($state eq 'body') { - $state = 'results' if $line eq ''; - } elsif ($state =~ /^results/) { - $state = 'results2'; - my ($status) = $line =~ /^(\S*)\b.*/; - $config{$h}{'status-ipv4'} = $status if $ipv4; - $config{$h}{'status-ipv6'} = $status if $ipv6; - if ($status eq 'NOERROR') { - $config{$h}{'ipv4'} = $ipv4; - $config{$h}{'ipv6'} = $ipv6; - $config{$h}{'mtime'} = $now; - success("$h: IPv4 address set to $ipv4") if $ipv4; - success("$h: IPv6 address set to $ipv6") if $ipv6; - } elsif ($status =~ /TOOSOON/) { - ## make sure we wait at least a little - my ($wait, $units) = (5, 'm'); - my ($sec, $scale) = ($wait, 1); - ($scale, $units) = (1, 'seconds') if $units eq 's'; - ($scale, $units) = (60, 'minutes') if $units eq 'm'; - ($scale, $units) = (60*60, 'hours') if $units eq 'h'; - $config{$h}{'wtime'} = $now + $sec; - warning("$h: $status: wait $wait $units before further updates"); - } elsif (exists $errors{$status}) { - failed("$h: $status: $errors{$status}"); - } else { - failed("$h: unexpected result: $line"); - } - last; - } + (my $body = $reply) =~ s/^.*?\n\n//s or do { + failed("$h: Could not connect to $config{$h}{'server'}"); + next; + }; + my ($status) = $body =~ qr/^(\S*)\b/; + $config{$h}{'status-ipv4'} = $status if $ipv4; + $config{$h}{'status-ipv6'} = $status if $ipv6; + if ($status eq 'NOERROR') { + $config{$h}{'ipv4'} = $ipv4; + $config{$h}{'ipv6'} = $ipv6; + $config{$h}{'mtime'} = $now; + success("$h: IPv4 address set to $ipv4") if $ipv4; + success("$h: IPv6 address set to $ipv6") if $ipv6; + } elsif ($status =~ /TOOSOON/) { + ## make sure we wait at least a little + my ($wait, $units) = (5, 'm'); + my ($sec, $scale) = ($wait, 1); + ($scale, $units) = (1, 'seconds') if $units eq 's'; + ($scale, $units) = (60, 'minutes') if $units eq 'm'; + ($scale, $units) = (60*60, 'hours') if $units eq 'h'; + $config{$h}{'wtime'} = $now + $sec; + warning("$h: $status: wait $wait $units before further updates"); + } elsif (exists $errors{$status}) { + failed("$h: $status: $errors{$status}"); + } else { + failed("$h: unexpected result: $body"); } - failed("$h: Could not connect to $config{$h}{'server'}") if $state ne 'results2'; } } From fb990208b38ba9c1444181f56a4750612f37e072 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 20 Jul 2024 01:30:44 -0400 Subject: [PATCH 05/12] easydns: Consolidate lines for readability --- ddclient.in | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/ddclient.in b/ddclient.in index 4f3fc4a..39b367e 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4802,20 +4802,13 @@ sub nic_easydns_update { info("$h: setting IPv4 address to $ipv4") if $ipv4; info("$h: setting IPv6 address to $ipv6") if $ipv6; #'https://api.cp.easydns.com/dyn/generic.php?hostname=test.burry.ca&myip=10.20.30.40&wildcard=ON' - my $url; - $url = "https://$config{$h}{'server'}$config{$h}{'script'}?"; - $url .= "hostname=$h"; - $url .= "&myip="; + my $url = "https://$config{$h}{'server'}$config{$h}{'script'}?hostname=$h&myip="; $url .= $ipv4 if $ipv4; - for my $ipv6a ($ipv6) { - $url .= "&myip="; - $url .= $ipv6a - } - $url .= "&wildcard=" . ynu($config{$h}{'wildcard'}, 'ON', 'OFF', 'OFF') if defined $config{$h}{'wildcard'}; - if ($config{$h}{'mx'}) { - $url .= "&mx=$config{$h}{'mx'}"; - $url .= "&backmx=" . ynu($config{$h}{'backupmx'}, 'YES', 'NO'); - } + $url .= "&myip=$_" for $ipv6; + $url .= "&wildcard=" . ynu($config{$h}{'wildcard'}, 'ON', 'OFF', 'OFF') + if defined($config{$h}{'wildcard'}); + $url .= "&mx=$config{$h}{'mx'}&backmx=" . ynu($config{$h}{'backupmx'}, 'YES', 'NO') + if $config{$h}{'mx'}; my $reply = geturl( proxy => opt('proxy'), url => $url, From 7a4b96e04ece39d073e050978c06e50a44b8b314 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 19 Jul 2024 19:26:08 -0400 Subject: [PATCH 06/12] easydns: Delete incorrect handling of `TOOSOON` error Before: * `$scale` was ignored causing it to set `wtime` to 5s in the future, which is too brief. Fortunately, `min-error-interval` applied which prevented overly aggressive retries. * The lack of call to `failed` meant that `$result` was not set to "FAILED" and thus `mail-failure` recipients were not emailed. Now `TOOSOON` is treated like any other error and will result in a retry after `min-error-interval` (default: 5m). --- ddclient.in | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ddclient.in b/ddclient.in index 39b367e..ec9c2eb 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4833,15 +4833,6 @@ sub nic_easydns_update { $config{$h}{'mtime'} = $now; success("$h: IPv4 address set to $ipv4") if $ipv4; success("$h: IPv6 address set to $ipv6") if $ipv6; - } elsif ($status =~ /TOOSOON/) { - ## make sure we wait at least a little - my ($wait, $units) = (5, 'm'); - my ($sec, $scale) = ($wait, 1); - ($scale, $units) = (1, 'seconds') if $units eq 's'; - ($scale, $units) = (60, 'minutes') if $units eq 'm'; - ($scale, $units) = (60*60, 'hours') if $units eq 'h'; - $config{$h}{'wtime'} = $now + $sec; - warning("$h: $status: wait $wait $units before further updates"); } elsif (exists $errors{$status}) { failed("$h: $status: $errors{$status}"); } else { From da26fe76e0e67b17c0719a3a9059c6847c5880b0 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 20 Jul 2024 02:07:27 -0400 Subject: [PATCH 07/12] easydns: Update IPv4 and IPv6 separately https://kb.easydns.com/knowledge/dynamic-dns/ doesn't say anything about repeating the `myip` parameter, or that both IPv4 and IPv6 addresses can be included in the same `myip` parameter. Unfortunately it also doesn't say whether updating the IPv4 address alone will nuke the IPv6 AAAA record, or whether updating the IPv6 address alone will nuke the IPv4 A record (like Google Domains used to do). Here's hoping that the A and AAAA records are truly independent. --- ChangeLog.md | 3 +++ ddclient.in | 75 ++++++++++++++++++++++++---------------------------- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 02667c4..36f0f65 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -124,6 +124,9 @@ repository history](https://github.com/ddclient/ddclient/commits/master). [#692](https://github.com/ddclient/ddclient/pull/692) * `regfishde`: Fixed IPv6 support. [#691](https://github.com/ddclient/ddclient/pull/691) + * `easydns`: IPv4 and IPv6 addresses are now updated separately to be + consistent with the easyDNS documentation. + [#713](https://github.com/ddclient/ddclient/pull/713) ## 2023-11-23 v3.11.2 diff --git a/ddclient.in b/ddclient.in index ec9c2eb..c441be4 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4797,46 +4797,41 @@ sub nic_easydns_update { 'TOOSOON' => 'Update frequency is too short.', ); for my $h (@_) { - my $ipv4 = delete $config{$h}{'wantipv4'}; - my $ipv6 = delete $config{$h}{'wantipv6'}; - info("$h: setting IPv4 address to $ipv4") if $ipv4; - info("$h: setting IPv6 address to $ipv6") if $ipv6; - #'https://api.cp.easydns.com/dyn/generic.php?hostname=test.burry.ca&myip=10.20.30.40&wildcard=ON' - my $url = "https://$config{$h}{'server'}$config{$h}{'script'}?hostname=$h&myip="; - $url .= $ipv4 if $ipv4; - $url .= "&myip=$_" for $ipv6; - $url .= "&wildcard=" . ynu($config{$h}{'wildcard'}, 'ON', 'OFF', 'OFF') - if defined($config{$h}{'wildcard'}); - $url .= "&mx=$config{$h}{'mx'}&backmx=" . ynu($config{$h}{'backupmx'}, 'YES', 'NO') - if $config{$h}{'mx'}; - my $reply = geturl( - proxy => opt('proxy'), - url => $url, - login => $config{$h}{'login'}, - password => $config{$h}{'password'}, - ) // ''; - if ($reply eq '') { - failed("$h: Could not connect to $config{$h}{'server'}"); - next; - } - next if !header_ok($h, $reply); - (my $body = $reply) =~ s/^.*?\n\n//s or do { - failed("$h: Could not connect to $config{$h}{'server'}"); - next; - }; - my ($status) = $body =~ qr/^(\S*)\b/; - $config{$h}{'status-ipv4'} = $status if $ipv4; - $config{$h}{'status-ipv6'} = $status if $ipv6; - if ($status eq 'NOERROR') { - $config{$h}{'ipv4'} = $ipv4; - $config{$h}{'ipv6'} = $ipv6; - $config{$h}{'mtime'} = $now; - success("$h: IPv4 address set to $ipv4") if $ipv4; - success("$h: IPv6 address set to $ipv6") if $ipv6; - } elsif (exists $errors{$status}) { - failed("$h: $status: $errors{$status}"); - } else { - failed("$h: unexpected result: $body"); + for my $ipv ('4', '6') { + my $ip = delete $config{$h}{"wantipv$ipv"} or next; + info("$h: setting IPv$ipv address to $ip"); + #'https://api.cp.easydns.com/dyn/generic.php?hostname=test.burry.ca&myip=10.20.30.40&wildcard=ON' + my $url = "https://$config{$h}{'server'}$config{$h}{'script'}?hostname=$h&myip=$ip"; + $url .= "&wildcard=" . ynu($config{$h}{'wildcard'}, 'ON', 'OFF', 'OFF') + if defined($config{$h}{'wildcard'}); + $url .= "&mx=$config{$h}{'mx'}&backmx=" . ynu($config{$h}{'backupmx'}, 'YES', 'NO') + if $config{$h}{'mx'}; + my $reply = geturl( + proxy => opt('proxy'), + url => $url, + login => $config{$h}{'login'}, + password => $config{$h}{'password'}, + ) // ''; + if ($reply eq '') { + failed("$h: Could not connect to $config{$h}{'server'}"); + next; + } + next if !header_ok($h, $reply); + (my $body = $reply) =~ s/^.*?\n\n//s or do { + failed("$h: Could not connect to $config{$h}{'server'}"); + next; + }; + my ($status) = $body =~ qr/^(\S*)\b/; + $config{$h}{"status-ipv$ipv"} = $status; + if ($status eq 'NOERROR') { + $config{$h}{"ipv$ipv"} = $ip; + $config{$h}{'mtime'} = $now; + success("$h: IPv$ipv address set to $ip"); + } elsif (exists $errors{$status}) { + failed("$h: $status: $errors{$status}"); + } else { + failed("$h: unexpected result: $body"); + } } } } From 435357ac500ba8e725c58cd940fb144a50f5ab22 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 19 Jul 2024 19:39:00 -0400 Subject: [PATCH 08/12] easydns: Invert condition to improve readability --- ddclient.in | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ddclient.in b/ddclient.in index c441be4..7b34fbb 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4823,15 +4823,17 @@ sub nic_easydns_update { }; my ($status) = $body =~ qr/^(\S*)\b/; $config{$h}{"status-ipv$ipv"} = $status; - if ($status eq 'NOERROR') { - $config{$h}{"ipv$ipv"} = $ip; - $config{$h}{'mtime'} = $now; - success("$h: IPv$ipv address set to $ip"); - } elsif (exists $errors{$status}) { - failed("$h: $status: $errors{$status}"); - } else { - failed("$h: unexpected result: $body"); + if ($status ne 'NOERROR') { + if (exists $errors{$status}) { + failed("$h: $status: $errors{$status}"); + } else { + failed("$h: unexpected result: $body"); + } + next; } + $config{$h}{"ipv$ipv"} = $ip; + $config{$h}{'mtime'} = $now; + success("$h: IPv$ipv address set to $ip"); } } } From a724084114068b89ca73a96dbd6222fe62934c2e Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 20 Jul 2024 02:43:31 -0400 Subject: [PATCH 09/12] easydns: Fix extraction of result code from response body The server returns a full HTML document, not just the result code. Change equality check to a regex match that is resilient to server-side changes. --- ChangeLog.md | 2 ++ ddclient.in | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 36f0f65..6b88a03 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -127,6 +127,8 @@ repository history](https://github.com/ddclient/ddclient/commits/master). * `easydns`: IPv4 and IPv6 addresses are now updated separately to be consistent with the easyDNS documentation. [#713](https://github.com/ddclient/ddclient/pull/713) + * `easydns`: Fixed parsing of result code from server response. + [#713](https://github.com/ddclient/ddclient/pull/713) ## 2023-11-23 v3.11.2 diff --git a/ddclient.in b/ddclient.in index 7b34fbb..34f30a4 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4821,9 +4821,10 @@ sub nic_easydns_update { failed("$h: Could not connect to $config{$h}{'server'}"); next; }; - my ($status) = $body =~ qr/^(\S*)\b/; + my $resultcode_re = join('|', map({quotemeta} 'NOERROR', keys(%errors))); + my ($status) = $body =~ qr/\b($resultcode_re)\b/; $config{$h}{"status-ipv$ipv"} = $status; - if ($status ne 'NOERROR') { + if (($status // '') ne 'NOERROR') { if (exists $errors{$status}) { failed("$h: $status: $errors{$status}"); } else { From d8c74169eef8d3b60ed28c1291cd37d12a126066 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 20 Jul 2024 02:48:36 -0400 Subject: [PATCH 10/12] easydns: Include the full `ILLEGAL INPUT` result code in log messages --- ddclient.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddclient.in b/ddclient.in index 34f30a4..d374ba9 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4793,7 +4793,7 @@ sub nic_easydns_update { my %errors = ( 'NOACCESS' => 'Authentication failed. This happens if the username/password OR host or domain are wrong.', 'NOSERVICE' => 'Dynamic DNS is not turned on for this domain.', - 'ILLEGAL' => 'Client sent data that is not allowed in a dynamic DNS update.', + 'ILLEGAL INPUT' => 'Client sent data that is not allowed in a dynamic DNS update.', 'TOOSOON' => 'Update frequency is too short.', ); for my $h (@_) { From a7feb95091e751eacbca29e83957e222faddae1c Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 19 Jul 2024 20:19:02 -0400 Subject: [PATCH 11/12] easydns: Add missing `OK` and `NO_AUTH` result codes --- ddclient.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ddclient.in b/ddclient.in index d374ba9..814db04 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4792,6 +4792,7 @@ sub nic_easydns_update { debug("\nnic_easydns_update -------------------"); my %errors = ( 'NOACCESS' => 'Authentication failed. This happens if the username/password OR host or domain are wrong.', + 'NO_AUTH' => 'Authentication failed. This happens if the username/password OR host or domain are wrong.', 'NOSERVICE' => 'Dynamic DNS is not turned on for this domain.', 'ILLEGAL INPUT' => 'Client sent data that is not allowed in a dynamic DNS update.', 'TOOSOON' => 'Update frequency is too short.', @@ -4824,7 +4825,7 @@ sub nic_easydns_update { my $resultcode_re = join('|', map({quotemeta} 'NOERROR', keys(%errors))); my ($status) = $body =~ qr/\b($resultcode_re)\b/; $config{$h}{"status-ipv$ipv"} = $status; - if (($status // '') ne 'NOERROR') { + if (($status // '') !~ qr/^NOERROR|OK$/) { if (exists $errors{$status}) { failed("$h: $status: $errors{$status}"); } else { From 3c68abe551763eeaf5af28a76081f9f4caee815a Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 19 Jul 2024 20:24:38 -0400 Subject: [PATCH 12/12] easydns: Fix incorrect status value on success --- ChangeLog.md | 2 ++ ddclient.in | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 6b88a03..92a5474 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -129,6 +129,8 @@ repository history](https://github.com/ddclient/ddclient/commits/master). [#713](https://github.com/ddclient/ddclient/pull/713) * `easydns`: Fixed parsing of result code from server response. [#713](https://github.com/ddclient/ddclient/pull/713) + * `easydns`: Fixed successful updates treated as failed updates. + [#713](https://github.com/ddclient/ddclient/pull/713) ## 2023-11-23 v3.11.2 diff --git a/ddclient.in b/ddclient.in index 814db04..7302783 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4824,8 +4824,12 @@ sub nic_easydns_update { }; my $resultcode_re = join('|', map({quotemeta} 'NOERROR', keys(%errors))); my ($status) = $body =~ qr/\b($resultcode_re)\b/; + # 'good' is the only status value that ddclient considers to be successful. All other + # values are considered to be failures and will result in frequent retries (every + # min-error-interval, which defaults to 5m). + $status = 'good' if ($status // '') =~ qr/^NOERROR|OK$/; $config{$h}{"status-ipv$ipv"} = $status; - if (($status // '') !~ qr/^NOERROR|OK$/) { + if ($status ne 'good') { if (exists $errors{$status}) { failed("$h: $status: $errors{$status}"); } else {