4
0
Эх сурвалжийг харах

Hide the SNMP community string (and v3 passwords) from error messages
(Bernhard Fischer on nagiosplug-devel@)


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1809 f882894a-f735-0410-b71e-b25c423dba1c

Holger Weiss 18 жил өмнө
parent
commit
745b58a68b
2 өөрчлөгдсөн 12 нэмэгдсэн , 4 устгасан
  1. 2 1
      THANKS.in
  2. 10 3
      plugins/check_snmp.c

+ 2 - 1
THANKS.in

@@ -225,4 +225,5 @@ Christoph Schell
 Andrew Elwell
 Heiti Ernits
 Sebastien Guay
-MAtteo HCE Valsasna
+Matteo HCE Valsasna
+Bernhard Fischer

+ 10 - 3
plugins/check_snmp.c

@@ -148,6 +148,7 @@ main (int argc, char **argv)
 	int result = STATE_DEPENDENT;
 	char input_buffer[MAX_INPUT_BUFFER];
 	char *command_line = NULL;
+	char *cl_hidden_auth = NULL;
 	char *response = NULL;
 	char *outbuff;
 	char *output;
@@ -186,11 +187,17 @@ main (int argc, char **argv)
 		asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
 			PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto,
 			authpriv, server_address, port, oid);
+		asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
+			PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto,
+			"[authpriv]", server_address, port, oid);
 	}else{
 
 		asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
 			PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto,
 			authpriv, server_address, port, oid);
+		asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
+			PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto,
+			"[authpriv]", server_address, port, oid);
 	}
 	
 	if (verbose)
@@ -200,14 +207,14 @@ main (int argc, char **argv)
 	/* run the command */
 	child_process = spopen (command_line);
 	if (child_process == NULL) {
-		printf (_("Could not open pipe: %s\n"), command_line);
+		printf (_("Could not open pipe: %s\n"), cl_hidden_auth);
 		exit (STATE_UNKNOWN);
 	}
 
 #if 0		/* Removed May 29, 2007 */
 	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
 	if (child_stderr == NULL) {
-		printf (_("Could not open stderr for %s\n"), command_line);
+		printf (_("Could not open stderr for %s\n"), cl_hidden_auth);
 	}
 #endif
 
@@ -369,7 +376,7 @@ main (int argc, char **argv)
 		die (STATE_UNKNOWN,
 			_("%s problem - No data received from host\nCMD: %s\n"),
 			label,
-			command_line);
+			cl_hidden_auth);
 
 #if 0		/* Removed May 29, 2007 */
 	/* WARNING if output found on stderr */