From: Michael Tremer Date: Tue, 7 Jan 2020 14:41:13 +0000 (+0000) Subject: dns.cgi: Fix handling of WARNINGs from kdig X-Git-Tag: v2.25-core141~70^2~43 X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff_plain;h=984f14bdc4e1663200d286f98935158884366fa4 dns.cgi: Fix handling of WARNINGs from kdig There might be multiple warnings which must all be shown to the user. Signed-off-by: Stefan Schantl Signed-off-by: Michael Tremer --- diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi index a66b1ed08d..a878f1786b 100755 --- a/html/cgi-bin/dns.cgi +++ b/html/cgi-bin/dns.cgi @@ -795,10 +795,6 @@ sub check_nameserver($$$$) { my $output = join("", @output); my $status = 0; - if ($output =~ m/WARNING: (.*)/) { - return $1; - - } if ($output =~ m/status: (\w+)/) { $status = ($1 eq "NOERROR"); @@ -806,6 +802,18 @@ sub check_nameserver($$$$) { if (!$status) { return -1; } + } else { + my $warning; + + while ($output =~ m/WARNING: (.*)/g) { + # Add the current grabbed warning to the warning string. + $warning .= "$1\; "; + } + + # Return the warning string, if we grabbed at least one. + if ($warning) { + return $warning; + } } my @flags = ();