summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index d516fbc..2c62a23 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -963,11 +963,16 @@ validate_arguments ()
963 if (seclevel == NULL) 963 if (seclevel == NULL)
964 xasprintf(&seclevel, "noAuthNoPriv"); 964 xasprintf(&seclevel, "noAuthNoPriv");
965 965
966 if (secname == NULL)
967 die(STATE_UNKNOWN, _("Required parameter: %s\n"), "secname");
968
966 if (strcmp(seclevel, "noAuthNoPriv") == 0) { 969 if (strcmp(seclevel, "noAuthNoPriv") == 0) {
967 numauthpriv = 2; 970 numauthpriv = 4;
968 authpriv = calloc (numauthpriv, sizeof (char *)); 971 authpriv = calloc (numauthpriv, sizeof (char *));
969 authpriv[0] = strdup ("-l"); 972 authpriv[0] = strdup ("-l");
970 authpriv[1] = strdup ("noAuthNoPriv"); 973 authpriv[1] = strdup ("noAuthNoPriv");
974 authpriv[2] = strdup ("-u");
975 authpriv[3] = strdup (secname);
971 } else { 976 } else {
972 if (! ( (strcmp(seclevel, "authNoPriv")==0) || (strcmp(seclevel, "authPriv")==0) ) ) { 977 if (! ( (strcmp(seclevel, "authNoPriv")==0) || (strcmp(seclevel, "authPriv")==0) ) ) {
973 usage2 (_("Invalid seclevel"), seclevel); 978 usage2 (_("Invalid seclevel"), seclevel);
@@ -976,9 +981,6 @@ validate_arguments ()
976 if (authproto == NULL ) 981 if (authproto == NULL )
977 xasprintf(&authproto, DEFAULT_AUTH_PROTOCOL); 982 xasprintf(&authproto, DEFAULT_AUTH_PROTOCOL);
978 983
979 if (secname == NULL)
980 die(STATE_UNKNOWN, _("Required parameter: %s\n"), "secname");
981
982 if (authpasswd == NULL) 984 if (authpasswd == NULL)
983 die(STATE_UNKNOWN, _("Required parameter: %s\n"), "authpasswd"); 985 die(STATE_UNKNOWN, _("Required parameter: %s\n"), "authpasswd");
984 986