SF.net SVN: nagiosplug: [1809] nagiosplug/trunk

[email protected]
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
Revision: 1809
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1809&view=rev
Author:   hweiss
Date:     2007-10-24 08:08:34 -0700 (Wed, 24 Oct 2007)

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

Modified Paths:
--------------
    nagiosplug/trunk/THANKS.in
    nagiosplug/trunk/plugins/check_snmp.c

Modified: nagiosplug/trunk/THANKS.in
===================================================================
--- nagiosplug/trunk/THANKS.in	2007-10-15 06:52:56 UTC (rev 1808)
+++ nagiosplug/trunk/THANKS.in	2007-10-24 15:08:34 UTC (rev 1809)
@@ -225,4 +225,5 @@
 Andrew Elwell
 Heiti Ernits
 Sebastien Guay
-MAtteo HCE Valsasna
+Matteo HCE Valsasna
+Bernhard Fischer

Modified: nagiosplug/trunk/plugins/check_snmp.c
===================================================================
--- nagiosplug/trunk/plugins/check_snmp.c	2007-10-15 06:52:56 UTC (rev 1808)
+++ nagiosplug/trunk/plugins/check_snmp.c	2007-10-24 15:08:34 UTC (rev 1809)
@@ -148,6 +148,7 @@
 	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 @@
 		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 @@
 	/* 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 @@
 		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 */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.