summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 74cb2bc)
raw | patch | inline | side by side (parent: 74cb2bc)
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Mon, 11 Nov 2002 20:19:01 +0000 (20:19 +0000) | ||
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Mon, 11 Nov 2002 20:19:01 +0000 (20:19 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@186 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_snmp.c | patch | blob | history |
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 19306b5860377830611443d129c8a9a468a8627f..80366b81b43f9f3df3a572192854162490cf3151 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
-H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n\
[-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n\
[-l label] [-u units] [-p port-number] [-d delimiter]\n\
- [-D output-delimiter] [-m miblist]"
+ [-D output-delimiter] [-m miblist] [-P snmp version]\n\
+ [-L seclevel] [-U secname] [-a authproto] [-A authpasswd]\n\
+ [-X privpasswd]\n"
#define LONGOPTIONS "\
-H, --hostname=HOST\n\
secname = strscpy(secname, optarg);
break;
case 'a': /* auth protocol */
- authproto = strscpy(authproto, optarg);
+ asprintf (&authproto, optarg);
break;
case 'A': /* auth passwd */
authpasswd = strscpy(authpasswd, optarg);
if (units == NULL)
asprintf (&units, "");
- if ( strcmp(seclevel, "noAuthNoPriv") && strcmp(seclevel, "authNoPriv") && strcmp(seclevel, "authPriv") ) {
- if (seclevel == NULL)
- asprintf (&seclevel, "noAuthNoPriv");
- else {
- printf ("Invalid seclevel: %s! \n", seclevel);
- print_usage ();
- exit (STATE_UNKNOWN);
- }
- }
+ /* Need better checks to verify seclevel and authproto choices */
+
+ if (seclevel == NULL)
+ asprintf (&seclevel, "noAuthNoPriv");
- if ( strcmp (authproto, "SHA") && strcmp(authproto, "MD5") ) {
- if (authproto == NULL )
- asprintf(&authproto, DEFAULT_AUTH_PROTOCOL);
- else{
- printf ("Invalid authproto: %s! \n", authproto);
- print_usage ();
- exit (STATE_UNKNOWN);
- }
- }
-
+ if (authproto == NULL )
+ asprintf(&authproto, DEFAULT_AUTH_PROTOCOL);
+
- if (proto == NULL || !strcmp(proto,DEFAULT_PROTOCOL) ) { /* default protocol version */
+ if (proto == NULL || (strcmp(proto,DEFAULT_PROTOCOL) == 0) ) { /* default protocol version */
asprintf(&proto, DEFAULT_PROTOCOL);
asprintf(&authpriv, "%s%s", "-c ", community);
}
print_usage ();
exit (STATE_UNKNOWN);
}
- authpriv = ssprintf(authpriv, "-l authPriv -a %s -u %s -A %s -X %s ", authproto, secname, authpasswd, privpasswd);
+ authpriv = ssprintf(authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd);
}