Procházet zdrojové kódy

plugins/check_dns.c: Authoritative bool and logic

Flipped non_authoritative to be a logical use of true\false instead of inverse logic. Corrected use of -A so that it was respected properly and errors if non-auth responses are found.
Spenser Reinhardt před 12 roky
rodič
revize
bc827581b9
1 změnil soubory, kde provedl 5 přidání a 3 odebrání
  1. 5 3
      plugins/check_dns.c

+ 5 - 3
plugins/check_dns.c

@@ -94,7 +94,7 @@ main (int argc, char **argv)
   int n_addresses = 0;
   char *msg = NULL;
   char *temp_buffer = NULL;
-  int non_authoritative = FALSE;
+  int non_authoritative = TRUE;
   int result = STATE_UNKNOWN;
   double elapsed_time;
   long microsec;
@@ -154,8 +154,10 @@ main (int argc, char **argv)
       }
     }
 
-    if (strstr (chld_out.line[i], "Authoritative answers can be found from:"))
+    if (strstr (chld_out.line[i], "Authoritative answers can be found from:")) {
+      non_authoritative = FALSE;
       break;
+    }
     /* the server is responding, we just got the host name... */
     if (strstr (chld_out.line[i], "Name:"))
       parse_address = TRUE;
@@ -234,7 +236,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, "", 2))