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`.
This commit is contained in:
ThinkChaos 2022-12-28 17:31:16 -05:00
parent 1a6e4431ab
commit fcd3ef8b5a
No known key found for this signature in database

View file

@ -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);
}
}
}