Blob Blame History Raw
diff -up ./plugins/check_dns.c.fixes_for_release_201702 ./plugins/check_dns.c
--- ./plugins/check_dns.c.fixes_for_release_201702	2017-01-19 11:01:31.000000000 -0500
+++ ./plugins/check_dns.c	2017-02-24 16:00:27.484303747 -0500
@@ -28,9 +28,9 @@
 * 
 * 
 *****************************************************************************/
-#define IF_RECORD(label, querytype, verb_str) if (strstr (chld_out.line[i], label) && (strncmp(query_type, querytype, query_size) == 0 || strncmp(query_type, "-querytype=ANY", query_size) == 0)) { \
+#define IF_RECORD(label, querytype, verb_str, comp_str) if (strstr (chld_out.line[i], label) && (strncmp(query_type, querytype, query_size) == 0 || strncmp(query_type, "-querytype=ANY", query_size) == 0)) { \
       if (verbose) printf(verb_str); \
-      temp_buffer = rindex (chld_out.line[i], ' '); \
+      temp_buffer = rindex (chld_out.line[i], comp_str); \
       addresses[n_addresses++] = check_new_address(temp_buffer); \
       memset(query_found, '\0', sizeof(query_found)); \
       strncpy(query_found, querytype, sizeof(query_found)); 
@@ -189,22 +189,15 @@ main (int argc, char **argv)
     if (strstr (chld_out.line[i], "Name:"))
       parse_address = TRUE;
     /* begin handling types of records */
-    IF_RECORD("AAAA address", "-querytype=AAAA", "Found AAAA record\n") }
-    else IF_RECORD("exchanger =", "-querytype=MX", "Found MX record\n") }
-    else IF_RECORD("service =", "-querytype=SRV", "Found SRV record\n") }
-    else IF_RECORD("nameserver =", "-querytype=NS", "Found NS record\n") }
-    else IF_RECORD("dname =", "-querytype=DNAME", "Found DNAME record\n") }
-    else IF_RECORD("protocol =", "-querytype=WKS", "Found WKS record\n") }
-    else if (strstr (chld_out.line[i], "text =") && (strncmp(query_type, "-querytype=TXT", query_size) == 0 || strncmp(query_type, "-querytype=ANY", query_size) == 0)) {
-      if (verbose) printf("Found TXT record\n");
-      temp_buffer = index(chld_out.line[i], '"');
-      --temp_buffer;
-      addresses[n_addresses++] = check_new_address(temp_buffer);
-      memset(query_found, '\0', sizeof(query_found));
-      strncpy(query_found, "-querytype=TXT", sizeof(query_found)); 
-    }
+    IF_RECORD("AAAA address", "-querytype=AAAA", "Found AAAA record\n", ' ') }
+    else IF_RECORD("exchanger =", "-querytype=MX", "Found MX record\n", '=') }
+    else IF_RECORD("service =", "-querytype=SRV", "Found SRV record\n", ' ') }
+    else IF_RECORD("nameserver =", "-querytype=NS", "Found NS record\n", ' ') }
+    else IF_RECORD("dname =", "-querytype=DNAME", "Found DNAME record\n", ' ') }
+    else IF_RECORD("protocol =", "-querytype=WKS", "Found WKS record\n", ' ') }
+    else IF_RECORD("text =", "-querytype=TXT", "Found TXT record\n", '"') }
     /* only matching for origin records, if requested other fields could be included at a later date */
-    else IF_RECORD("origin =", "-querytype=SOA", "Found SOA record\n") }
+    else IF_RECORD("origin =", "-querytype=SOA", "Found SOA record\n", ' ') }
     /* cnames cannot use macro as we must check for accepting them separately */
     else if (accept_cname && strstr (chld_out.line[i], "canonical name =") && (strncmp(query_type, "-querytype=CNAME", query_size) == 0 || strncmp(query_type, "-querytype=ANY", query_size) == 0)) {
       if (verbose) printf("Found CNAME record\n");
@@ -220,7 +213,7 @@ main (int argc, char **argv)
       strncpy(query_found, "-querytype=A", sizeof(query_found));
     }
     /* must be after other records with "name" as an identifier, as ptr does not spefify */
-    else IF_RECORD("name =", "-querytype=PTR", "Found PTR record\n") }
+    else IF_RECORD("name =", "-querytype=PTR", "Found PTR record\n", ' ') }
     /* needed for non-query ptr\reverse lookup checks */
     else if (strstr(chld_out.line[i], ".in-addr.arpa") && !query_set) {
       if ((temp_buffer = strstr(chld_out.line[i], "name = ")))
diff -up ./plugins/check_snmp.c.fixes_for_release_201702 ./plugins/check_snmp.c
--- ./plugins/check_snmp.c.fixes_for_release_201702	2017-01-19 11:01:31.000000000 -0500
+++ ./plugins/check_snmp.c	2017-02-24 15:59:37.825036429 -0500
@@ -328,12 +328,12 @@ main (int argc, char **argv)
 		command_line[10 + numcontext + i] = authpriv[i];
 	}
 
-	xasprintf (&command_line[10 + numcontext + numauthpriv], "%s:%s", server_address, port);
+	xasprintf (&command_line[10 + numcontext + numauthpriv], "%s%s:%s", ip_version, server_address, port);
 
 	/* This is just for display purposes, so it can remain a string */
-	xasprintf(&cl_hidden_auth, "%s -Le -t %d -r %d -m %s -v %s %s %s %s:%s",
+	xasprintf(&cl_hidden_auth, "%s -Le -t %d -r %d -m %s -v %s %s %s %s%s:%s",
 		snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[context]", "[authpriv]",
-		server_address, port);
+		  ip_version, server_address, port);
 
 	for (i = 0; i < numoids; i++) {
 		command_line[10 + numcontext + numauthpriv + 1 + i] = oids[i];
@@ -705,8 +705,8 @@ process_arguments (int argc, char **argv
 		{"offset", required_argument, 0, L_OFFSET},
 		{"invert-search", no_argument, 0, L_INVERT_SEARCH},
 		{"perf-oids", no_argument, 0, 'O'},
-		{"ipv4", no_argument, 0, '4'},
-		{"ipv6", no_argument, 0, '6'},
+		{"use-ipv4", no_argument, 0, '4'},
+		{"use-ipv6", no_argument, 0, '6'},
 		{0, 0, 0, 0}
 	};
 
@@ -724,7 +724,7 @@ process_arguments (int argc, char **argv
 	}
 
 	while (1) {
-		c = getopt_long (argc, argv, "nhvVOt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:",
+		c = getopt_long (argc, argv, "nhvVO46t:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:",
 									 longopts, &option);
 
 		if (c == -1 || c == EOF)
@@ -1276,5 +1276,5 @@ print_usage (void)
 	printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n");
 	printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n");
 	printf ("[-m miblist] [-P snmp version] [-N context] [-L seclevel] [-U secname]\n");
-	printf ("[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd]\n");
+	printf ("[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd] [-4|6]\n");
 }