]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
dns.cgi: Fix handling of WARNINGs from kdig
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 7 Jan 2020 14:41:13 +0000 (14:41 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 7 Jan 2020 14:41:13 +0000 (14:41 +0000)
There might be multiple warnings which must all be shown
to the user.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/dns.cgi

index a66b1ed08d5150246420ef78f2856937d3498457..a878f1786b29fc3cdf8de4b63f422231528d48ad 100755 (executable)
@@ -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 = ();