aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
authorGravatar Holger Weiss <hweiss@users.sourceforge.net> 2007-10-24 15:08:34 +0000
committerGravatar Holger Weiss <hweiss@users.sourceforge.net> 2007-10-24 15:08:34 +0000
commit745b58a68bf2e60a6652475c56a1cff0aa6ebf9f (patch)
tree869ef139168a71fb534b9b7050f514e4ce26569b /plugins/check_snmp.c
parenta8eac11bd65edb76d3b33b7a2e51846c467a1220 (diff)
downloadmonitoring-plugins-745b58a68bf2e60a6652475c56a1cff0aa6ebf9f.tar.gz
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
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index fd3028cf..845c1bb4 100644
--- a/plugins/check_snmp.c
+++ b/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 */