From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- .../121779-nagiosplug-cvs-check_snmp.diff | 116 +++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 web/attachments/121779-nagiosplug-cvs-check_snmp.diff (limited to 'web/attachments/121779-nagiosplug-cvs-check_snmp.diff') diff --git a/web/attachments/121779-nagiosplug-cvs-check_snmp.diff b/web/attachments/121779-nagiosplug-cvs-check_snmp.diff new file mode 100644 index 0000000..d2c1cde --- /dev/null +++ b/web/attachments/121779-nagiosplug-cvs-check_snmp.diff @@ -0,0 +1,116 @@ +diff -urN ./plugins/check_snmp.c ../plugins/plugins/check_snmp.c +--- ./plugins/check_snmp.c 2005-01-24 08:29:54.000000000 +0100 ++++ ../plugins/plugins/check_snmp.c 2005-02-17 16:53:58.000000000 +0100 +@@ -36,6 +36,7 @@ + #define DEFAULT_AUTH_PROTOCOL "MD5" + #define DEFAULT_DELIMITER "=" + #define DEFAULT_OUTPUT_DELIMITER " " ++#define DEFAULT_SEC_LEVEL "noAuthNoPriv" + + #define mark(a) ((a)!=0?"*":"") + +@@ -88,12 +89,12 @@ + #endif + + char *server_address = NULL; +-char *community = NULL; ++char *community = DEFAULT_COMMUNITY; + char *authpriv = NULL; +-char *proto = NULL; +-char *seclevel = NULL; ++char *proto = DEFAULT_PROTOCOL; ++char *seclevel = DEFAULT_SEC_LEVEL; + char *secname = NULL; +-char *authproto = NULL; ++char *authproto = DEFAULT_AUTH_PROTOCOL; + char *authpasswd = NULL; + char *privpasswd = NULL; + char *oid; +@@ -147,15 +148,15 @@ + eval_method[i] = CHECK_UNDEF; + i = 0; + +- oid = strdup (""); +- label = strdup ("SNMP"); +- units = strdup (""); +- port = strdup (DEFAULT_PORT); +- outbuff = strdup (""); +- output = strdup (""); +- delimiter = strdup (DEFAULT_DELIMITER); +- output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); +- miblist = strdup (DEFAULT_MIBLIST); ++ oid = ""; ++ label = "SNMP"; ++ units = ""; ++ port = DEFAULT_PORT; ++ outbuff = ""; ++ output = ""; ++ delimiter = DEFAULT_DELIMITER; ++ output_delim = DEFAULT_OUTPUT_DELIMITER; ++ miblist = DEFAULT_MIBLIST; + timeout_interval = DEFAULT_TIMEOUT; + retries = DEFAULT_RETRIES; + +@@ -598,9 +599,6 @@ + if (server_address == NULL) + server_address = argv[optind]; + +- if (community == NULL) +- community = strdup (DEFAULT_COMMUNITY); +- + return validate_arguments (); + } + +@@ -631,30 +629,28 @@ + validate_arguments () + { + +- /* Need better checks to verify seclevel and authproto choices */ +- +- if (seclevel == NULL) +- asprintf (&seclevel, "noAuthNoPriv"); ++ /* Need checks to verify seclevel and authproto choices */ + ++ /* default protocol is set in variable declaraion, so this can't ++ * possibly be NULL any-more. It can, however, be a zero length string ++ * (if a check_command is specified that can use either v1 or v2c, the ++ * $ARGx$ macro is quote-escaped and not given in service-description) ++ * in which case we don't fuss much about it but just set it to default */ ++ if (!strlen(proto)) ++ proto = DEFAULT_PROTOCOL; + +- if (authproto == NULL ) +- asprintf(&authproto, DEFAULT_AUTH_PROTOCOL); +- +- +- +- if (proto == NULL || (strcmp(proto,DEFAULT_PROTOCOL) == 0) ) { /* default protocol version */ +- asprintf(&proto, DEFAULT_PROTOCOL); ++ if (proto[0] == '1' || proto[0] == '2') { /* community based access */ + asprintf(&authpriv, "%s%s", "-c ", community); + } + else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ +- asprintf(&proto, "%s", "3"); +- ++ proto = "3"; ++ + if ( (strcmp(seclevel, "noAuthNoPriv") == 0) || seclevel == NULL ) { +- asprintf(&authpriv, "%s", "-l noAuthNoPriv" ); ++ asprintf(&authpriv, "%s %s", "-l", DEFAULT_SEC_LEVEL); + } + else if ( strcmp(seclevel, "authNoPriv") == 0 ) { + if ( secname == NULL || authpasswd == NULL) { +- printf (_("Missing secname (%s) or authpassword (%s) ! \n"),secname, authpasswd ); ++ printf (_("Missing secname or authpassword!\n")); + print_usage (); + exit (STATE_UNKNOWN); + } +@@ -662,7 +658,7 @@ + } + else if ( strcmp(seclevel, "authPriv") == 0 ) { + if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) { +- printf (_("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd ); ++ printf (_("Missing secname, authpassword or privpasswd!\n")); + print_usage (); + exit (STATE_UNKNOWN); + } -- cgit v1.2.3-74-g34f1