diff options
author | Roy Li <rongqing.li@windriver.com> | 2014-11-04 14:09:29 +0800 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2014-11-04 16:01:01 -0500 |
commit | 4bb8bb5e478453d64a899e500c33aaa56981dc75 (patch) | |
tree | f22af3ed5f2527ad64210f5c82920f00321585e8 /meta-networking/recipes-protocols | |
parent | e3a1a2d839abdba4618ff9fdbb6ffd12488acea0 (diff) | |
download | meta-openembedded-4bb8bb5e478453d64a899e500c33aaa56981dc75.tar.gz |
net-snmp: fix for Security Advisory - CVE-2014-3565
snmplib/mib.c in net-snmp 5.7.0 and earlier, when the -OQ option is used,
allows remote attackers to cause a denial of service (snmptrapd crash) via
a crafted SNMP trap message, which triggers a conversion to the variable
type designated in the MIB file, as demonstrated by a NULL type in an ifMtu
trap message.
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-3565
Signed-off-by: Roy Li <rongqing.li@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking/recipes-protocols')
2 files changed, 456 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Added-checks-for-printing-variables-with-wrong-types.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Added-checks-for-printing-variables-with-wrong-types.patch new file mode 100644 index 000000000..30374cfe9 --- /dev/null +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Added-checks-for-printing-variables-with-wrong-types.patch | |||
@@ -0,0 +1,455 @@ | |||
1 | From 7f4a7b891332899cea26e95be0337aae01648742 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jan Safranek <jsafranek@users.sourceforge.net> | ||
3 | Date: Thu, 31 Jul 2014 13:46:49 +0200 | ||
4 | Subject: [PATCH] Added checks for printing variables with wrong types. | ||
5 | |||
6 | Upstream-Status: Backport | ||
7 | |||
8 | When -OQ command line argument is used, variable formatter preffers the type | ||
9 | of the varible parsed from a MIB file instead of checking type of the variable | ||
10 | as parsed from SNMP message. | ||
11 | |||
12 | This can lead to crashes when incoming packets contains a variable with | ||
13 | NULL type, while the MIB says the variable should be non-NULL, like Integer. | ||
14 | The formatter then tries to interpret the NULL (from packet) as Integer (from | ||
15 | MIB file). | ||
16 | |||
17 | Signed-off-by: Jan Safranek <jsafranek@users.sourceforge.net> | ||
18 | --- | ||
19 | snmplib/mib.c | 270 ++++++++++++++++++++++++++++----------------------------- | ||
20 | 1 file changed, 135 insertions(+), 135 deletions(-) | ||
21 | |||
22 | diff --git a/snmplib/mib.c b/snmplib/mib.c | ||
23 | index 9d3ca41..c6e0010 100644 | ||
24 | --- a/snmplib/mib.c | ||
25 | +++ b/snmplib/mib.c | ||
26 | @@ -439,17 +439,16 @@ sprint_realloc_octet_string(u_char ** buf, size_t * buf_len, | ||
27 | u_char *cp; | ||
28 | int output_format, cnt; | ||
29 | |||
30 | - if ((var->type != ASN_OCTET_STR) && | ||
31 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
32 | - const char str[] = "Wrong Type (should be OCTET STRING): "; | ||
33 | - if (snmp_cstrcat | ||
34 | - (buf, buf_len, out_len, allow_realloc, str)) { | ||
35 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
36 | + if (var->type != ASN_OCTET_STR) { | ||
37 | + if (!netsnmp_ds_get_boolean( | ||
38 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
39 | + const char str[] = "Wrong Type (should be OCTET STRING): "; | ||
40 | + if (!snmp_cstrcat(buf, buf_len, out_len, allow_realloc, str)) | ||
41 | + return 0; | ||
42 | + } | ||
43 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
44 | allow_realloc, var, NULL, NULL, | ||
45 | NULL); | ||
46 | - } else { | ||
47 | - return 0; | ||
48 | - } | ||
49 | } | ||
50 | |||
51 | |||
52 | @@ -702,16 +701,16 @@ sprint_realloc_float(u_char ** buf, size_t * buf_len, | ||
53 | const struct enum_list *enums, | ||
54 | const char *hint, const char *units) | ||
55 | { | ||
56 | - if ((var->type != ASN_OPAQUE_FLOAT) && | ||
57 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
58 | - if (snmp_cstrcat(buf, buf_len, out_len, allow_realloc, | ||
59 | - "Wrong Type (should be Float): ")) { | ||
60 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
61 | + if (var->type != ASN_OPAQUE_FLOAT) { | ||
62 | + if (!netsnmp_ds_get_boolean( | ||
63 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
64 | + u_char str[] = "Wrong Type (should be Float): "; | ||
65 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
66 | + return 0; | ||
67 | + } | ||
68 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
69 | allow_realloc, var, NULL, NULL, | ||
70 | NULL); | ||
71 | - } else { | ||
72 | - return 0; | ||
73 | - } | ||
74 | } | ||
75 | |||
76 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
77 | @@ -772,17 +771,16 @@ sprint_realloc_double(u_char ** buf, size_t * buf_len, | ||
78 | const struct enum_list *enums, | ||
79 | const char *hint, const char *units) | ||
80 | { | ||
81 | - if ((var->type != ASN_OPAQUE_DOUBLE) && | ||
82 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
83 | - if (snmp_cstrcat | ||
84 | - (buf, buf_len, out_len, allow_realloc, | ||
85 | - "Wrong Type (should be Double): ")) { | ||
86 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
87 | + if (var->type != ASN_OPAQUE_DOUBLE) { | ||
88 | + if (!netsnmp_ds_get_boolean( | ||
89 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
90 | + u_char str[] = "Wrong Type (should be Double): "; | ||
91 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
92 | + return 0; | ||
93 | + } | ||
94 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
95 | allow_realloc, var, NULL, NULL, | ||
96 | NULL); | ||
97 | - } else { | ||
98 | - return 0; | ||
99 | - } | ||
100 | } | ||
101 | |||
102 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
103 | @@ -847,20 +845,21 @@ sprint_realloc_counter64(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
104 | { | ||
105 | char a64buf[I64CHARSZ + 1]; | ||
106 | |||
107 | - if ((var->type != ASN_COUNTER64 | ||
108 | + if (var->type != ASN_COUNTER64 | ||
109 | #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES | ||
110 | && var->type != ASN_OPAQUE_COUNTER64 | ||
111 | && var->type != ASN_OPAQUE_I64 && var->type != ASN_OPAQUE_U64 | ||
112 | #endif | ||
113 | - ) && (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
114 | - if (snmp_cstrcat(buf, buf_len, out_len, allow_realloc, | ||
115 | - "Wrong Type (should be Counter64): ")) { | ||
116 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
117 | + ) { | ||
118 | + if (!netsnmp_ds_get_boolean( | ||
119 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
120 | + u_char str[] = "Wrong Type (should be Counter64): "; | ||
121 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
122 | + return 0; | ||
123 | + } | ||
124 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
125 | allow_realloc, var, NULL, NULL, | ||
126 | NULL); | ||
127 | - } else { | ||
128 | - return 0; | ||
129 | - } | ||
130 | } | ||
131 | |||
132 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
133 | @@ -948,23 +947,25 @@ sprint_realloc_opaque(u_char ** buf, size_t * buf_len, | ||
134 | const struct enum_list *enums, | ||
135 | const char *hint, const char *units) | ||
136 | { | ||
137 | - if ((var->type != ASN_OPAQUE | ||
138 | + if (var->type != ASN_OPAQUE | ||
139 | #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES | ||
140 | && var->type != ASN_OPAQUE_COUNTER64 | ||
141 | && var->type != ASN_OPAQUE_U64 | ||
142 | && var->type != ASN_OPAQUE_I64 | ||
143 | && var->type != ASN_OPAQUE_FLOAT && var->type != ASN_OPAQUE_DOUBLE | ||
144 | #endif /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */ | ||
145 | - ) && (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
146 | - if (snmp_cstrcat(buf, buf_len, out_len, allow_realloc, | ||
147 | - "Wrong Type (should be Opaque): ")) { | ||
148 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
149 | + ) { | ||
150 | + if (!netsnmp_ds_get_boolean( | ||
151 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
152 | + u_char str[] = "Wrong Type (should be Opaque): "; | ||
153 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
154 | + return 0; | ||
155 | + } | ||
156 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
157 | allow_realloc, var, NULL, NULL, | ||
158 | NULL); | ||
159 | - } else { | ||
160 | - return 0; | ||
161 | - } | ||
162 | } | ||
163 | + | ||
164 | #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES | ||
165 | switch (var->type) { | ||
166 | case ASN_OPAQUE_COUNTER64: | ||
167 | @@ -1040,17 +1041,16 @@ sprint_realloc_object_identifier(u_char ** buf, size_t * buf_len, | ||
168 | { | ||
169 | int buf_overflow = 0; | ||
170 | |||
171 | - if ((var->type != ASN_OBJECT_ID) && | ||
172 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
173 | - u_char str[] = | ||
174 | - "Wrong Type (should be OBJECT IDENTIFIER): "; | ||
175 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
176 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
177 | + if (var->type != ASN_OBJECT_ID) { | ||
178 | + if (!netsnmp_ds_get_boolean( | ||
179 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
180 | + u_char str[] = "Wrong Type (should be OBJECT IDENTIFIER): "; | ||
181 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
182 | + return 0; | ||
183 | + } | ||
184 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
185 | allow_realloc, var, NULL, NULL, | ||
186 | NULL); | ||
187 | - } else { | ||
188 | - return 0; | ||
189 | - } | ||
190 | } | ||
191 | |||
192 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
193 | @@ -1110,16 +1110,16 @@ sprint_realloc_timeticks(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
194 | { | ||
195 | char timebuf[40]; | ||
196 | |||
197 | - if ((var->type != ASN_TIMETICKS) && | ||
198 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
199 | - u_char str[] = "Wrong Type (should be Timeticks): "; | ||
200 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
201 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
202 | + if (var->type != ASN_TIMETICKS) { | ||
203 | + if (!netsnmp_ds_get_boolean( | ||
204 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
205 | + u_char str[] = "Wrong Type (should be Timeticks): "; | ||
206 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
207 | + return 0; | ||
208 | + } | ||
209 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
210 | allow_realloc, var, NULL, NULL, | ||
211 | NULL); | ||
212 | - } else { | ||
213 | - return 0; | ||
214 | - } | ||
215 | } | ||
216 | |||
217 | if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS)) { | ||
218 | @@ -1277,17 +1277,18 @@ sprint_realloc_integer(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
219 | { | ||
220 | char *enum_string = NULL; | ||
221 | |||
222 | - if ((var->type != ASN_INTEGER) && | ||
223 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
224 | - u_char str[] = "Wrong Type (should be INTEGER): "; | ||
225 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
226 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
227 | + if (var->type != ASN_INTEGER) { | ||
228 | + if (!netsnmp_ds_get_boolean( | ||
229 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
230 | + u_char str[] = "Wrong Type (should be INTEGER): "; | ||
231 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
232 | + return 0; | ||
233 | + } | ||
234 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
235 | allow_realloc, var, NULL, NULL, | ||
236 | NULL); | ||
237 | - } else { | ||
238 | - return 0; | ||
239 | - } | ||
240 | } | ||
241 | + | ||
242 | for (; enums; enums = enums->next) { | ||
243 | if (enums->value == *var->val.integer) { | ||
244 | enum_string = enums->label; | ||
245 | @@ -1380,16 +1381,16 @@ sprint_realloc_uinteger(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
246 | { | ||
247 | char *enum_string = NULL; | ||
248 | |||
249 | - if ((var->type != ASN_UINTEGER) && | ||
250 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
251 | - u_char str[] = "Wrong Type (should be UInteger32): "; | ||
252 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
253 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
254 | + if (var->type != ASN_UINTEGER) { | ||
255 | + if (!netsnmp_ds_get_boolean( | ||
256 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
257 | + u_char str[] = "Wrong Type (should be UInteger32): "; | ||
258 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
259 | + return 0; | ||
260 | + } | ||
261 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
262 | allow_realloc, var, NULL, NULL, | ||
263 | NULL); | ||
264 | - } else { | ||
265 | - return 0; | ||
266 | - } | ||
267 | } | ||
268 | |||
269 | for (; enums; enums = enums->next) { | ||
270 | @@ -1477,17 +1478,16 @@ sprint_realloc_gauge(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
271 | { | ||
272 | char tmp[32]; | ||
273 | |||
274 | - if ((var->type != ASN_GAUGE) && | ||
275 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
276 | - u_char str[] = | ||
277 | - "Wrong Type (should be Gauge32 or Unsigned32): "; | ||
278 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
279 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
280 | + if (var->type != ASN_GAUGE) { | ||
281 | + if (!netsnmp_ds_get_boolean( | ||
282 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
283 | + u_char str[] = "Wrong Type (should be Gauge32 or Unsigned32): "; | ||
284 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
285 | + return 0; | ||
286 | + } | ||
287 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
288 | allow_realloc, var, NULL, NULL, | ||
289 | NULL); | ||
290 | - } else { | ||
291 | - return 0; | ||
292 | - } | ||
293 | } | ||
294 | |||
295 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
296 | @@ -1550,16 +1550,16 @@ sprint_realloc_counter(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
297 | { | ||
298 | char tmp[32]; | ||
299 | |||
300 | - if ((var->type != ASN_COUNTER) && | ||
301 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
302 | - u_char str[] = "Wrong Type (should be Counter32): "; | ||
303 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
304 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
305 | + if (var->type != ASN_COUNTER) { | ||
306 | + if (!netsnmp_ds_get_boolean( | ||
307 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
308 | + u_char str[] = "Wrong Type (should be Counter32): "; | ||
309 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
310 | + return 0; | ||
311 | + } | ||
312 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
313 | allow_realloc, var, NULL, NULL, | ||
314 | NULL); | ||
315 | - } else { | ||
316 | - return 0; | ||
317 | - } | ||
318 | } | ||
319 | |||
320 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
321 | @@ -1613,16 +1613,16 @@ sprint_realloc_networkaddress(u_char ** buf, size_t * buf_len, | ||
322 | { | ||
323 | size_t i; | ||
324 | |||
325 | - if ((var->type != ASN_IPADDRESS) && | ||
326 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
327 | - u_char str[] = "Wrong Type (should be NetworkAddress): "; | ||
328 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
329 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
330 | + if (var->type != ASN_IPADDRESS) { | ||
331 | + if (!netsnmp_ds_get_boolean( | ||
332 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
333 | + u_char str[] = "Wrong Type (should be NetworkAddress): "; | ||
334 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
335 | + return 0; | ||
336 | + } | ||
337 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
338 | allow_realloc, var, NULL, NULL, | ||
339 | NULL); | ||
340 | - } else { | ||
341 | - return 0; | ||
342 | - } | ||
343 | } | ||
344 | |||
345 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
346 | @@ -1679,16 +1679,16 @@ sprint_realloc_ipaddress(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
347 | { | ||
348 | u_char *ip = var->val.string; | ||
349 | |||
350 | - if ((var->type != ASN_IPADDRESS) && | ||
351 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
352 | - u_char str[] = "Wrong Type (should be IpAddress): "; | ||
353 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
354 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
355 | + if (var->type != ASN_IPADDRESS) { | ||
356 | + if (!netsnmp_ds_get_boolean( | ||
357 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
358 | + u_char str[] = "Wrong Type (should be IpAddress): "; | ||
359 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
360 | + return 0; | ||
361 | + } | ||
362 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
363 | allow_realloc, var, NULL, NULL, | ||
364 | NULL); | ||
365 | - } else { | ||
366 | - return 0; | ||
367 | - } | ||
368 | } | ||
369 | |||
370 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
371 | @@ -1737,20 +1737,20 @@ sprint_realloc_null(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
372 | const struct enum_list *enums, | ||
373 | const char *hint, const char *units) | ||
374 | { | ||
375 | - if ((var->type != ASN_NULL) && | ||
376 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
377 | - u_char str[] = "Wrong Type (should be NULL): "; | ||
378 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
379 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
380 | + if (var->type != ASN_NULL) { | ||
381 | + if (!netsnmp_ds_get_boolean( | ||
382 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
383 | + u_char str[] = "Wrong Type (should be NULL): "; | ||
384 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
385 | + return 0; | ||
386 | + } | ||
387 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
388 | allow_realloc, var, NULL, NULL, | ||
389 | NULL); | ||
390 | - } else { | ||
391 | - return 0; | ||
392 | - } | ||
393 | - } else { | ||
394 | - u_char str[] = "NULL"; | ||
395 | - return snmp_strcat(buf, buf_len, out_len, allow_realloc, str); | ||
396 | } | ||
397 | + | ||
398 | + u_char str[] = "NULL"; | ||
399 | + return snmp_strcat(buf, buf_len, out_len, allow_realloc, str); | ||
400 | } | ||
401 | |||
402 | |||
403 | @@ -1785,16 +1785,16 @@ sprint_realloc_bitstring(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
404 | u_char *cp; | ||
405 | char *enum_string; | ||
406 | |||
407 | - if ((var->type != ASN_BIT_STR && var->type != ASN_OCTET_STR) && | ||
408 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
409 | - u_char str[] = "Wrong Type (should be BITS): "; | ||
410 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
411 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
412 | + if (var->type != ASN_BIT_STR && var->type != ASN_OCTET_STR) { | ||
413 | + if (!netsnmp_ds_get_boolean( | ||
414 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
415 | + u_char str[] = "Wrong Type (should be BITS): "; | ||
416 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
417 | + return 0; | ||
418 | + } | ||
419 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
420 | allow_realloc, var, NULL, NULL, | ||
421 | NULL); | ||
422 | - } else { | ||
423 | - return 0; | ||
424 | - } | ||
425 | } | ||
426 | |||
427 | if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
428 | @@ -1869,16 +1869,16 @@ sprint_realloc_nsapaddress(u_char ** buf, size_t * buf_len, | ||
429 | const struct enum_list *enums, const char *hint, | ||
430 | const char *units) | ||
431 | { | ||
432 | - if ((var->type != ASN_NSAP) && | ||
433 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
434 | - u_char str[] = "Wrong Type (should be NsapAddress): "; | ||
435 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
436 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
437 | + if (var->type != ASN_NSAP) { | ||
438 | + if (!netsnmp_ds_get_boolean( | ||
439 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
440 | + u_char str[] = "Wrong Type (should be NsapAddress): "; | ||
441 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
442 | + return 0; | ||
443 | + } | ||
444 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
445 | allow_realloc, var, NULL, NULL, | ||
446 | NULL); | ||
447 | - } else { | ||
448 | - return 0; | ||
449 | - } | ||
450 | } | ||
451 | |||
452 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
453 | -- | ||
454 | 1.7.10.4 | ||
455 | |||
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb index 9012615c6..a76de0d3b 100644 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb | |||
@@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://README;beginline=3;endline=8;md5=7f7f00ba639ac8e8deb5 | |||
7 | DEPENDS = "openssl libnl pciutils" | 7 | DEPENDS = "openssl libnl pciutils" |
8 | 8 | ||
9 | SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \ | 9 | SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \ |
10 | file://0001-Added-checks-for-printing-variables-with-wrong-types.patch \ | ||
10 | file://init \ | 11 | file://init \ |
11 | file://snmpd.conf \ | 12 | file://snmpd.conf \ |
12 | file://snmptrapd.conf \ | 13 | file://snmptrapd.conf \ |