summaryrefslogtreecommitdiffstats
path: root/web/attachments/26654-snmpv3.dif
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/26654-snmpv3.dif')
-rw-r--r--web/attachments/26654-snmpv3.dif167
1 files changed, 167 insertions, 0 deletions
diff --git a/web/attachments/26654-snmpv3.dif b/web/attachments/26654-snmpv3.dif
new file mode 100644
index 0000000..d4d9ecb
--- /dev/null
+++ b/web/attachments/26654-snmpv3.dif
@@ -0,0 +1,167 @@
1--- plugins/check_snmp.c.orig Thu Feb 28 07:42:59 2002
2+++ plugins/check_snmp.c Tue Jul 9 11:48:10 2002
3@@ -97,6 +97,12 @@
4 char oid[MAX_INPUT_BUFFER] = "";
5 char *label = NULL;
6 char *units = NULL;
7+char *secname = NULL;
8+char *seclevel = NULL;
9+char *authproto = NULL;
10+char *authpasswd = NULL;
11+char *privpasswd = NULL;
12+int proto = 1;
13 char string_value[MAX_INPUT_BUFFER] = "";
14 char **labels = NULL;
15 char **unitv = NULL;
16@@ -143,10 +149,35 @@
17 usage ("Incorrect arguments supplied\n");
18
19 /* create the command line to execute */
20- command_line = ssprintf
21+ if (proto == 3) {
22+ if ( strcmp(seclevel, "noAuthNoPriv") == 0 ) {
23+ command_line = ssprintf
24+ (command_line,
25+ "%s -m ALL -v 3 -l noAuthNoPriv %s %s",
26+ PATH_TO_SNMPGET, server_address, oid);
27+ }
28+ if ( strcmp(seclevel, "authNoPriv") == 0 ) {
29+ command_line = ssprintf
30+ (command_line,
31+ "%s -m ALL -v 3 -l authNoPriv -a %s -u %s -A %s %s %s",
32+ PATH_TO_SNMPGET, authproto, secname, authpasswd,
33+ server_address, oid);
34+ }
35+ if ( strcmp(seclevel, "authPriv") == 0 ) {
36+ command_line = ssprintf
37+ (command_line,
38+ "%s -m ALL -v 3 -l authPriv -a %s -u %s -A %s -X %s %s %s",
39+ PATH_TO_SNMPGET, authproto, secname, authpasswd,
40+ privpasswd, server_address, oid);
41+ }
42+ } else {
43+ command_line = ssprintf
44 (command_line,
45 "%s -m ALL -v 1 %s %s %s",
46 PATH_TO_SNMPGET, server_address, community, oid);
47+ }
48+
49+
50
51 /* run the command */
52 child_process = spopen (command_line);
53@@ -285,7 +316,7 @@
54 if (found == 0)
55 terminate
56 (STATE_UNKNOWN,
57- "%s problem - No data recieved from host\nCMD: %s\n",
58+ "%s problem - No data received from host\nCMD: %s\n",
59 label, command_line);
60
61 /* WARNING if output found on stderr */
62@@ -348,6 +379,13 @@
63 if (units == NULL)
64 units = strscpy (NULL, "");
65
66+ if (seclevel == NULL || ( strcmp(seclevel, "authNoPriv") &&
67+ strcmp(seclevel, "authPriv") ) )
68+ seclevel = strscpy (NULL, "noAuthNoPriv");
69+
70+ if (authproto == NULL)
71+ authproto = strscpy (NULL, "MD5");
72+
73 return c;
74 }
75
76@@ -378,6 +416,12 @@
77 {"eregi", required_argument, 0, 'R'},
78 {"label", required_argument, 0, 'l'},
79 {"units", required_argument, 0, 'u'},
80+ {"protocol", required_argument,0, 'p'},
81+ {"seclevel", required_argument,0, 'L'},
82+ {"authproto", required_argument,0, 'a'},
83+ {"authpasswd", required_argument,0, 'A'},
84+ {"privpasswd", required_argument,0, 'X'},
85+ {"secname", required_argument, 0, 'U'},
86 {0, 0, 0, 0}
87 };
88 #endif
89@@ -385,10 +429,10 @@
90 while (1) {
91 #ifdef HAVE_GETOPT_H
92 c =
93- getopt_long (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:",
94+ getopt_long (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:p:L:a:A:X:U:",
95 long_options, &option_index);
96 #else
97- c = getopt (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:");
98+ c = getopt (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:p:L:a:A:X:U:");
99 #endif
100
101 if (c == -1 || c == EOF)
102@@ -409,6 +453,12 @@
103 case 'r':
104 case 'l':
105 case 'u':
106+ case 'p':
107+ case 'L':
108+ case 'a':
109+ case 'A':
110+ case 'X':
111+ case 'U':
112 i++;
113 }
114
115@@ -568,6 +618,24 @@
116 unitv[nunits - 1] = ptr;
117 }
118 break;
119+ case 'p':
120+ proto = atoi(optarg);
121+ break;
122+ case 'L':
123+ seclevel = strscpy (seclevel, optarg);
124+ break;
125+ case 'a':
126+ authproto = strscpy (authproto, optarg);
127+ break;
128+ case 'A':
129+ authpasswd = strscpy (authpasswd, optarg);
130+ break;
131+ case 'X':
132+ privpasswd = strscpy (privpasswd, optarg);
133+ break;
134+ case 'U':
135+ secname = strscpy (secname, optarg);
136+ break;
137 }
138 }
139 return i;
140@@ -580,6 +648,8 @@
141 ("Usage: check_snmp -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n"
142 " [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n"
143 " [-l label] [-u units] [-d delimiter] [-D output-delimiter]\n"
144+ " [-p protocol] [-L seclevel] [-a authproto] [-A authpasswd]\n"
145+ " [-X privpasswd] [-U secname]\n"
146 " check_snmp --help\n" " check_snmp --version\n");
147 }
148
149@@ -597,6 +667,18 @@
150 " Print version information\n"
151 " -H, --hostname=HOST\n"
152 " Name or IP address of the device you wish to query\n"
153+ " -p, --protocol=[1|3]\n"
154+ " SNMP protocol version\n"
155+ " -L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]\n"
156+ " SNMPv3 securityLevel\n"
157+ " -U, --secname=USERNAME\n"
158+ " SNMPv3 username\n"
159+ " -a, --authproto=[MD5|SHA]\n"
160+ " SNMPv3 authproto\n"
161+ " -A, --authpasswd=PASSWORD\n"
162+ " SNMPv3 authentication password\n"
163+ " -X, --privpasswd=PASSWORD\n"
164+ " SNMPv3 crypt password (DES)\n"
165 " -o, --oid=OID(s)\n"
166 " Object identifier(s) whose value you wish to query\n"
167 " -w, --warning=INTEGER_RANGE(s)\n"