From a724084114068b89ca73a96dbd6222fe62934c2e Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 20 Jul 2024 02:43:31 -0400 Subject: [PATCH] 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 {