diff options
author | Holger Weiss <hweiss@users.sourceforge.net> | 2007-10-24 15:08:34 +0000 |
---|---|---|
committer | Holger Weiss <hweiss@users.sourceforge.net> | 2007-10-24 15:08:34 +0000 |
commit | 745b58a68bf2e60a6652475c56a1cff0aa6ebf9f (patch) | |
tree | 869ef139168a71fb534b9b7050f514e4ce26569b /plugins/check_snmp.c | |
parent | a8eac11bd65edb76d3b33b7a2e51846c467a1220 (diff) | |
download | monitoring-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.c | 13 |
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) | |||
148 | int result = STATE_DEPENDENT; | 148 | int result = STATE_DEPENDENT; |
149 | char input_buffer[MAX_INPUT_BUFFER]; | 149 | char input_buffer[MAX_INPUT_BUFFER]; |
150 | char *command_line = NULL; | 150 | char *command_line = NULL; |
151 | char *cl_hidden_auth = NULL; | ||
151 | char *response = NULL; | 152 | char *response = NULL; |
152 | char *outbuff; | 153 | char *outbuff; |
153 | char *output; | 154 | char *output; |
@@ -186,11 +187,17 @@ main (int argc, char **argv) | |||
186 | asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | 187 | asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", |
187 | PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto, | 188 | PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto, |
188 | authpriv, server_address, port, oid); | 189 | authpriv, server_address, port, oid); |
190 | asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
191 | PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto, | ||
192 | "[authpriv]", server_address, port, oid); | ||
189 | }else{ | 193 | }else{ |
190 | 194 | ||
191 | asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | 195 | asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", |
192 | PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto, | 196 | PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto, |
193 | authpriv, server_address, port, oid); | 197 | authpriv, server_address, port, oid); |
198 | asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
199 | PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto, | ||
200 | "[authpriv]", server_address, port, oid); | ||
194 | } | 201 | } |
195 | 202 | ||
196 | if (verbose) | 203 | if (verbose) |
@@ -200,14 +207,14 @@ main (int argc, char **argv) | |||
200 | /* run the command */ | 207 | /* run the command */ |
201 | child_process = spopen (command_line); | 208 | child_process = spopen (command_line); |
202 | if (child_process == NULL) { | 209 | if (child_process == NULL) { |
203 | printf (_("Could not open pipe: %s\n"), command_line); | 210 | printf (_("Could not open pipe: %s\n"), cl_hidden_auth); |
204 | exit (STATE_UNKNOWN); | 211 | exit (STATE_UNKNOWN); |
205 | } | 212 | } |
206 | 213 | ||
207 | #if 0 /* Removed May 29, 2007 */ | 214 | #if 0 /* Removed May 29, 2007 */ |
208 | child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | 215 | child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); |
209 | if (child_stderr == NULL) { | 216 | if (child_stderr == NULL) { |
210 | printf (_("Could not open stderr for %s\n"), command_line); | 217 | printf (_("Could not open stderr for %s\n"), cl_hidden_auth); |
211 | } | 218 | } |
212 | #endif | 219 | #endif |
213 | 220 | ||
@@ -369,7 +376,7 @@ main (int argc, char **argv) | |||
369 | die (STATE_UNKNOWN, | 376 | die (STATE_UNKNOWN, |
370 | _("%s problem - No data received from host\nCMD: %s\n"), | 377 | _("%s problem - No data received from host\nCMD: %s\n"), |
371 | label, | 378 | label, |
372 | command_line); | 379 | cl_hidden_auth); |
373 | 380 | ||
374 | #if 0 /* Removed May 29, 2007 */ | 381 | #if 0 /* Removed May 29, 2007 */ |
375 | /* WARNING if output found on stderr */ | 382 | /* WARNING if output found on stderr */ |