Просмотр исходного кода

check_dns: authoritative test (-A) is broken

Fix for issue #203
John C. Frickson 9 лет назад
Родитель
Сommit
59a835b6a6
2 измененных файлов с 4 добавлено и 5 удалено
  1. 1 0
      NEWS
  2. 3 5
      plugins/check_dns.c

+ 1 - 0
NEWS

@@ -23,6 +23,7 @@ This file documents the major additions and syntax changes between releases.
 	fix: Dead assignment
 	Shellcheck: fix most of the shellcheck warnings.
 	check_ntp: touch ntp servers at most once every seconds
+	check_dns: authoritative test (-A) is broken
 
 
 2.1.4 2016-11-17

+ 3 - 5
plugins/check_dns.c

@@ -102,7 +102,7 @@ main (int argc, char **argv)
   char query_found[24] = "";
   int query_size = 24;
   char *temp_buffer = NULL;
-  int non_authoritative = TRUE;
+  int non_authoritative = FALSE;
   int result = STATE_UNKNOWN;
   double elapsed_time;
   long microsec;
@@ -183,10 +183,8 @@ main (int argc, char **argv)
 	}
     }
 
-    if (strstr (chld_out.line[i], "Authoritative answers can be found from:")) {
-      non_authoritative = FALSE;
+    if (strstr (chld_out.line[i], "Authoritative answers can be found from:"))
       break;
-    }
     /* the server is responding, we just got the host name...*/
     if (strstr (chld_out.line[i], "Name:"))
       parse_address = TRUE;
@@ -294,7 +292,7 @@ main (int argc, char **argv)
   }
 
   /* check if authoritative */
-  if (result == STATE_OK && expect_authority && !non_authoritative) {
+  if (result == STATE_OK && expect_authority && non_authoritative) {
     result = STATE_CRITICAL;
 
     if (strncmp(dns_server, "", 1))