From fcd3ef8b5a6d05afeae8f53cae3697c77f393d32 Mon Sep 17 00:00:00 2001 From: ThinkChaos Date: Wed, 28 Dec 2022 17:31:16 -0500 Subject: [PATCH] fix: nic_ovh_update not ignoring extra data Example bodies I've seen: ``` 0013 good 127.0.0.1 0 ``` ``` 0013 nochg 127.0.0.1 0 ``` ``` 007 nohost 0 ``` Seems like the trailing zero was not there before as the code relied on `pop`. Instead, we find the first line that matches `good`/`nochg`. --- ddclient.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ddclient.in b/ddclient.in index 3df624d..27975ca 100755 --- a/ddclient.in +++ b/ddclient.in @@ -6850,8 +6850,8 @@ sub nic_ovh_update { } my @reply = split /\n/, $reply; - my $returned = pop(@reply); - if ($returned =~ /good/ || $returned =~ /nochg/) { + my $returned = List::Util::first { $_ =~ /good/ || $_ =~ /nochg/ } @reply; + if ($returned) { $config{$h}{'ip'} = $ip; $config{$h}{'mtime'} = $now; $config{$h}{'status'} = 'good'; @@ -6862,7 +6862,7 @@ sub nic_ovh_update { } } else { $config{$h}{'status'} = 'failed'; - failed("updating %s: Server said: '%s'", $h, $returned); + failed("updating %s: Server said: '%s'", $h, $reply); } } }