summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_snmp.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index d5abd8c2..3c054259 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -235,8 +235,23 @@ int main(int argc, char **argv) {
235 if (verbose) { 235 if (verbose) {
236 printf("Debug: Got a string\n"); 236 printf("Debug: Got a string\n");
237 } 237 }
238
238 char *tmp = (char *)vars->val.string; 239 char *tmp = (char *)vars->val.string;
239 xasprintf(&sc_oid_test.output, "%s - Value: %s", sc_oid_test.output, tmp); 240
241 if (strchr(tmp, '"') != NULL) {
242 // got double quote in the string
243 if (strchr(tmp, '\'') != NULL) {
244 // got single quote in the string too
245 // dont quote that at all to avoid even more confusion
246 xasprintf(&sc_oid_test.output, "%s - Value: %s", sc_oid_test.output, tmp);
247 } else {
248 // quote with single quotes
249 xasprintf(&sc_oid_test.output, "%s - Value: '%s'", sc_oid_test.output, tmp);
250 }
251 } else {
252 // quote with double quotes
253 xasprintf(&sc_oid_test.output, "%s - Value: \"%s\"", sc_oid_test.output, tmp);
254 }
240 255
241 if (strlen(tmp) == 0) { 256 if (strlen(tmp) == 0) {
242 sc_oid_test = mp_set_subcheck_state(sc_oid_test, config.nulloid_result); 257 sc_oid_test = mp_set_subcheck_state(sc_oid_test, config.nulloid_result);