From 0e3fa54782f8cbb47af058c4bf13688e8b23865b Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Fri, 24 Feb 2012 12:29:00 +0100 Subject: Accept multiple labels specified with "-l" Fix the code which accepts a comma-separated list of labels specified via the "-l" option. (Spotted by Oskar Liljeblad in Debian bug report #647020, forwarded by Jan Wagner.) diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index d79da8c..6c90909 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -749,7 +749,7 @@ process_arguments (int argc, char **argv) if (labels == NULL) die (STATE_UNKNOWN, _("Could not reallocate labels\n")); } - labels++; + nlabels++; ptr = thisarg (ptr); if (strstr (ptr, "'") == ptr) labels[nlabels - 1] = ptr + 1; @@ -1072,8 +1072,8 @@ print_help (void) printf ("\n"); printf ("%s\n", _("Notes:")); - printf (" %s\n", _("- Multiple OIDs may be indicated by a comma or space-delimited list (lists with")); - printf (" %s %i %s\n", _("internal spaces must be quoted). Maximum:"), MAX_OIDS, _("OIDs.")); + printf (" %s\n", _("- Multiple OIDs (and labels) may be indicated by a comma or space-delimited ")); + printf (" %s %i %s\n", _("list (lists with internal spaces must be quoted). Maximum:"), MAX_OIDS, _("OIDs.")); printf(" -%s", UT_THRESHOLDS_NOTES); -- cgit v0.10-9-g596f From b93c8eebc70153866d8c5a6872b6c7c4ccd94860 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Fri, 24 Feb 2012 12:31:20 +0100 Subject: Cosmetic change Replace all occurrences of "strstr(s, "c") == s" with "s[0] == 'c'". diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 6c90909..4cd3805 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -740,7 +740,7 @@ process_arguments (int argc, char **argv) labels[nlabels - 1] = optarg; ptr = thisarg (optarg); labels[nlabels - 1] = ptr; - if (strstr (ptr, "'") == ptr) + if (ptr[0] == '\'') labels[nlabels - 1] = ptr + 1; while (ptr && (ptr = nextarg (ptr))) { if (nlabels >= labels_size) { @@ -751,7 +751,7 @@ process_arguments (int argc, char **argv) } nlabels++; ptr = thisarg (ptr); - if (strstr (ptr, "'") == ptr) + if (ptr[0] == '\'') labels[nlabels - 1] = ptr + 1; else labels[nlabels - 1] = ptr; @@ -769,7 +769,7 @@ process_arguments (int argc, char **argv) unitv[nunits - 1] = optarg; ptr = thisarg (optarg); unitv[nunits - 1] = ptr; - if (strstr (ptr, "'") == ptr) + if (ptr[0] == '\'') unitv[nunits - 1] = ptr + 1; while (ptr && (ptr = nextarg (ptr))) { if (nunits >= unitv_size) { @@ -780,7 +780,7 @@ process_arguments (int argc, char **argv) } nunits++; ptr = thisarg (ptr); - if (strstr (ptr, "'") == ptr) + if (ptr[0] == '\'') unitv[nunits - 1] = ptr + 1; else unitv[nunits - 1] = ptr; @@ -935,7 +935,7 @@ char * thisarg (char *str) { str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ - if (strstr (str, "'") == str) { /* handle SIMPLE quoted strings */ + if (str[0] == '\'') { /* handle SIMPLE quoted strings */ if (strlen (str) == 1 || !strstr (str + 1, "'")) die (STATE_UNKNOWN, _("Unbalanced quotes\n")); } @@ -951,7 +951,7 @@ thisarg (char *str) char * nextarg (char *str) { - if (strstr (str, "'") == str) { + if (str[0] == '\'') { str[0] = 0; if (strlen (str) > 1) { str = strstr (str + 1, "'"); @@ -961,7 +961,7 @@ nextarg (char *str) return NULL; } } - if (strstr (str, ",") == str) { + if (str[0] == ',') { str[0] = 0; if (strlen (str) > 1) { return (++str); -- cgit v0.10-9-g596f From d796c16327e6e315dd528f17e8bd597c5f506730 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Fri, 24 Feb 2012 13:24:56 +0100 Subject: Clarify that check_http won't verify certificates Add a note to the --help output which clarifies that check_http doesn't perform certificate verification (beyond what the "-C" option does). (Suggested by Michael Renner in Debian bug report #644627, forwarded by Jan Wagner.) diff --git a/plugins/check_http.c b/plugins/check_http.c index 433c28e..3175f6c 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -1400,6 +1400,10 @@ print_help (void) printf (" %s\n", _("serve content (optionally within a specified time) or whether the X509 ")); printf (" %s\n", _("certificate is still valid for the specified number of days.")); printf ("\n"); + printf (" %s\n", _("Please note that this plugin does not check if the presented server")); + printf (" %s\n", _("certificate matches the hostname of the server, or if the certificate")); + printf (" %s\n", _("has a valid chain of trust to one of the locally installed CAs.")); + printf ("\n"); printf ("%s\n", _("Examples:")); printf (" %s\n\n", "CHECK CONTENT: check_http -w 5 -c 10 --ssl -H www.verisign.com"); printf (" %s\n", _("When the 'www.verisign.com' server returns its content within 5 seconds,")); -- cgit v0.10-9-g596f