Deleted Added
full compact
hostres_swinstalled_tbl.c (154133) hostres_swinstalled_tbl.c (160341)
1/*
2 * Copyright (c) 2005-2006 The FreeBSD Project
3 * All rights reserved.
4 *
5 * Author: Victor Cruceru <soc-victor@freebsd.org>
6 *
7 * Redistribution of this software and documentation and use in source and
8 * binary forms, with or without modification, are permitted provided that

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*
2 * Copyright (c) 2005-2006 The FreeBSD Project
3 * All rights reserved.
4 *
5 * Author: Victor Cruceru <soc-victor@freebsd.org>
6 *
7 * Redistribution of this software and documentation and use in source and
8 * binary forms, with or without modification, are permitted provided that

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swinstalled_tbl.c 154133 2006-01-09 12:33:45Z harti $
29 * $FreeBSD: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swinstalled_tbl.c 160341 2006-07-14 09:07:56Z harti $
30 *
31 * Host Resources MIB implementation for SNMPd: instrumentation for
32 * hrSWInstalledTable
33 */
34
35#include <sys/limits.h>
36#include <sys/stat.h>
37#include <sys/sysctl.h>
38#include <sys/utsname.h>
39
40#include <assert.h>
41#include <dirent.h>
42#include <err.h>
43#include <errno.h>
44#include <stdlib.h>
45#include <string.h>
46#include <syslog.h>
30 *
31 * Host Resources MIB implementation for SNMPd: instrumentation for
32 * hrSWInstalledTable
33 */
34
35#include <sys/limits.h>
36#include <sys/stat.h>
37#include <sys/sysctl.h>
38#include <sys/utsname.h>
39
40#include <assert.h>
41#include <dirent.h>
42#include <err.h>
43#include <errno.h>
44#include <stdlib.h>
45#include <string.h>
46#include <syslog.h>
47#include <sysexits.h>
47
48#include "hostres_snmp.h"
49#include "hostres_oid.h"
50#include "hostres_tree.h"
51
48
49#include "hostres_snmp.h"
50#include "hostres_oid.h"
51#include "hostres_tree.h"
52
52#define CONTENTS_FNAME "+CONTENTS"
53#define CONTENTS_FNAME "+CONTENTS"
53
54enum SWInstalledType {
55 SWI_UNKNOWN = 1,
56 SWI_OPERATING_SYSTEM = 2,
57 SWI_DEVICE_DRIVER = 3,
58 SWI_APPLICATION = 4
59};
60
54
55enum SWInstalledType {
56 SWI_UNKNOWN = 1,
57 SWI_OPERATING_SYSTEM = 2,
58 SWI_DEVICE_DRIVER = 3,
59 SWI_APPLICATION = 4
60};
61
61#define NAMELEN 64 /* w/o \0 */
62#define SW_NAME_MLEN (64 + 1)
62
63/*
64 * This structure is used to hold a SNMP table entry
65 * for HOST-RESOURCES-MIB's hrSWInstalledTable
66 */
67struct swins_entry {
68 int32_t index;
63
64/*
65 * This structure is used to hold a SNMP table entry
66 * for HOST-RESOURCES-MIB's hrSWInstalledTable
67 */
68struct swins_entry {
69 int32_t index;
69 u_char name[NAMELEN + 1];
70 struct asn_oid id;
71 int32_t type; /* from enum SWInstalledType */
70 u_char *name; /* max len for this is SW_NAME_MLEN */
71 const struct asn_oid *id;
72 int32_t type; /* from enum SWInstalledType */
72 u_char date[11];
73 u_int date_len;
74
73 u_char date[11];
74 u_int date_len;
75
75#define HR_SWINSTALLED_FOUND 0x001
76#define HR_SWINSTALLED_IMMUTABLE 0x002
76#define HR_SWINSTALLED_FOUND 0x001
77#define HR_SWINSTALLED_IMMUTABLE 0x002
77 uint32_t flags;
78
79 TAILQ_ENTRY(swins_entry) link;
80};
81TAILQ_HEAD(swins_tbl, swins_entry);
82
83/*
84 * Table to keep a conistent mapping between software and indexes.
85 */
86struct swins_map_entry {
78 uint32_t flags;
79
80 TAILQ_ENTRY(swins_entry) link;
81};
82TAILQ_HEAD(swins_tbl, swins_entry);
83
84/*
85 * Table to keep a conistent mapping between software and indexes.
86 */
87struct swins_map_entry {
87 int32_t index; /* hrSWInstalledTblEntry::index */
88 u_char name[NAMELEN + 1]; /* map key */
88 int32_t index; /* swins_entry::index */
89 u_char *name; /* map key,a copy of swins_entry::name*/
89
90 /*
91 * next may be NULL if the respective hrSWInstalledTblEntry
92 * is (temporally) gone
93 */
94 struct swins_entry *entry;
95
90
91 /*
92 * next may be NULL if the respective hrSWInstalledTblEntry
93 * is (temporally) gone
94 */
95 struct swins_entry *entry;
96
96 STAILQ_ENTRY(swins_map_entry) link;
97 STAILQ_ENTRY(swins_map_entry) link;
97};
98STAILQ_HEAD(swins_map, swins_map_entry);
99
100/* map for consistent indexing */
101static struct swins_map swins_map = STAILQ_HEAD_INITIALIZER(swins_map);
102
103/* the head of the list with hrSWInstalledTable's entries */
104static struct swins_tbl swins_tbl = TAILQ_HEAD_INITIALIZER(swins_tbl);

--- 17 unchanged lines hidden (view full) ---

122 * Create a new entry into the hrSWInstalledTable
123 */
124static struct swins_entry *
125swins_entry_create(const char *name)
126{
127 struct swins_entry *entry;
128 struct swins_map_entry *map;
129
98};
99STAILQ_HEAD(swins_map, swins_map_entry);
100
101/* map for consistent indexing */
102static struct swins_map swins_map = STAILQ_HEAD_INITIALIZER(swins_map);
103
104/* the head of the list with hrSWInstalledTable's entries */
105static struct swins_tbl swins_tbl = TAILQ_HEAD_INITIALIZER(swins_tbl);

--- 17 unchanged lines hidden (view full) ---

123 * Create a new entry into the hrSWInstalledTable
124 */
125static struct swins_entry *
126swins_entry_create(const char *name)
127{
128 struct swins_entry *entry;
129 struct swins_map_entry *map;
130
130 if ((entry = malloc(sizeof(*entry))) == NULL) {
131 syslog(LOG_WARNING, "%s: %m", __func__);
132 return (NULL);
133 }
134 memset(entry, 0, sizeof(*entry));
135 strlcpy((char*)entry->name, name, sizeof(entry->name));
136
137 STAILQ_FOREACH(map, &swins_map, link)
131 STAILQ_FOREACH(map, &swins_map, link)
138 if (strcmp((const char *)map->name,
139 (const char *)entry->name) == 0)
132 if (strcmp((const char *)map->name, name) == 0)
140 break;
141
142 if (map == NULL) {
133 break;
134
135 if (map == NULL) {
136 size_t name_len;
143 /* new object - get a new index */
144 if (next_swins_index > INT_MAX) {
145 syslog(LOG_ERR, "%s: hrSWInstalledTable index wrap",
146 __func__ );
137 /* new object - get a new index */
138 if (next_swins_index > INT_MAX) {
139 syslog(LOG_ERR, "%s: hrSWInstalledTable index wrap",
140 __func__ );
147 free(entry);
148 return (NULL);
141 /* There isn't much we can do here.
142 * If the next_swins_index is consumed
143 * then we can't add entries to this table
144 * So it is better to exit - if the table is sparsed
145 * at the next agent run we can fill it fully.
146 */
147 errx(EX_SOFTWARE, "hrSWInstalledTable index wrap");
149 }
150
151 if ((map = malloc(sizeof(*map))) == NULL) {
152 syslog(LOG_ERR, "%s: %m", __func__ );
148 }
149
150 if ((map = malloc(sizeof(*map))) == NULL) {
151 syslog(LOG_ERR, "%s: %m", __func__ );
153 free(entry);
154 return (NULL);
155 }
152 return (NULL);
153 }
154
155 name_len = strlen(name) + 1;
156 if (name_len > SW_NAME_MLEN)
157 name_len = SW_NAME_MLEN;
158
159 if ((map->name = malloc(name_len)) == NULL) {
160 syslog(LOG_WARNING, "%s: %m", __func__);
161 free(map);
162 return (NULL);
163 }
164
156 map->index = next_swins_index++;
165 map->index = next_swins_index++;
157 strcpy((char *)map->name, (const char *)entry->name);
166 strlcpy((char *)map->name, name, name_len);
158
159 STAILQ_INSERT_TAIL(&swins_map, map, link);
160
161 HRDBG("%s added into hrSWInstalled at %d", name, map->index);
162 }
167
168 STAILQ_INSERT_TAIL(&swins_map, map, link);
169
170 HRDBG("%s added into hrSWInstalled at %d", name, map->index);
171 }
172
173 if ((entry = malloc(sizeof(*entry))) == NULL) {
174 syslog(LOG_WARNING, "%s: %m", __func__);
175 return (NULL);
176 }
177 memset(entry, 0, sizeof(*entry));
178
179 if ((entry->name = strdup(map->name)) == NULL) {
180 syslog(LOG_WARNING, "%s: %m", __func__);
181 free(entry);
182 return (NULL);
183 }
184
163 entry->index = map->index;
164 map->entry = entry;
165
166 INSERT_OBJECT_INT(entry, &swins_tbl);
167
168 return (entry);
169}
170

--- 10 unchanged lines hidden (view full) ---

181 TAILQ_REMOVE(&swins_tbl, entry, link);
182
183 STAILQ_FOREACH(map, &swins_map, link)
184 if (map->entry == entry) {
185 map->entry = NULL;
186 break;
187 }
188
185 entry->index = map->index;
186 map->entry = entry;
187
188 INSERT_OBJECT_INT(entry, &swins_tbl);
189
190 return (entry);
191}
192

--- 10 unchanged lines hidden (view full) ---

203 TAILQ_REMOVE(&swins_tbl, entry, link);
204
205 STAILQ_FOREACH(map, &swins_map, link)
206 if (map->entry == entry) {
207 map->entry = NULL;
208 break;
209 }
210
211 free(entry->name);
189 free(entry);
190}
191
192/**
193 * Find an entry given it's name
194 */
195static struct swins_entry *
196swins_find_by_name(const char *name)
197{
198 struct swins_entry *entry;
199
200 TAILQ_FOREACH(entry, &swins_tbl, link)
212 free(entry);
213}
214
215/**
216 * Find an entry given it's name
217 */
218static struct swins_entry *
219swins_find_by_name(const char *name)
220{
221 struct swins_entry *entry;
222
223 TAILQ_FOREACH(entry, &swins_tbl, link)
201 if (strncmp((const char*)entry->name, name,
202 sizeof(entry->name) - 1) == 0)
224 if (strcmp((const char*)entry->name, name) == 0)
203 return (entry);
204 return (NULL);
205}
206
207/**
208 * Finalize this table
209 */
210void
211fini_swins_tbl(void)
212{
213 struct swins_map_entry *n1;
214
215 while ((n1 = STAILQ_FIRST(&swins_map)) != NULL) {
216 STAILQ_REMOVE_HEAD(&swins_map, link);
217 if (n1->entry != NULL) {
218 TAILQ_REMOVE(&swins_tbl, n1->entry, link);
225 return (entry);
226 return (NULL);
227}
228
229/**
230 * Finalize this table
231 */
232void
233fini_swins_tbl(void)
234{
235 struct swins_map_entry *n1;
236
237 while ((n1 = STAILQ_FIRST(&swins_map)) != NULL) {
238 STAILQ_REMOVE_HEAD(&swins_map, link);
239 if (n1->entry != NULL) {
240 TAILQ_REMOVE(&swins_tbl, n1->entry, link);
241 free(n1->entry->name);
219 free(n1->entry);
220 }
242 free(n1->entry);
243 }
244 free(n1->name);
221 free(n1);
245 free(n1);
222 }
246 }
223 assert(TAILQ_EMPTY(&swins_tbl));
224}
225
226/**
227 * Get the *running* O/S identification
228 */
229static void
230swins_get_OS_ident(void)
231{
232 struct utsname os_id;
247 assert(TAILQ_EMPTY(&swins_tbl));
248}
249
250/**
251 * Get the *running* O/S identification
252 */
253static void
254swins_get_OS_ident(void)
255{
256 struct utsname os_id;
233 char os_string[NAMELEN + 1];
257 char os_string[SW_NAME_MLEN] = "";
234 struct swins_entry *entry;
235 u_char *boot;
236 struct stat sb;
237 struct tm k_ts;
238
258 struct swins_entry *entry;
259 u_char *boot;
260 struct stat sb;
261 struct tm k_ts;
262
239 if (uname(&os_id) == -1)
263 if (uname(&os_id) == -1) {
264 syslog(LOG_WARNING, "%s: %m", __func__);
240 return;
265 return;
266 }
241
242 snprintf(os_string, sizeof(os_string), "%s: %s",
243 os_id.sysname, os_id.version);
244
245 if ((entry = swins_find_by_name(os_string)) != NULL ||
246 (entry = swins_entry_create(os_string)) == NULL)
247 return;
248
249 entry->flags |= (HR_SWINSTALLED_FOUND | HR_SWINSTALLED_IMMUTABLE);
267
268 snprintf(os_string, sizeof(os_string), "%s: %s",
269 os_id.sysname, os_id.version);
270
271 if ((entry = swins_find_by_name(os_string)) != NULL ||
272 (entry = swins_entry_create(os_string)) == NULL)
273 return;
274
275 entry->flags |= (HR_SWINSTALLED_FOUND | HR_SWINSTALLED_IMMUTABLE);
250 entry->id = oid_zeroDotZero;
276 entry->id = &oid_zeroDotZero;
251 entry->type = (int32_t)SWI_OPERATING_SYSTEM;
252 memset(entry->date, 0, sizeof(entry->date));
253
254 if (OS_getSystemInitialLoadParameters(&boot) == SNMP_ERR_NOERROR &&
255 strlen(boot) > 0 && stat(boot, &sb) == 0 &&
256 localtime_r(&sb.st_ctime, &k_ts) != NULL)
257 entry->date_len = make_date_time(entry->date, &k_ts, 0);
258}
259
260/**
261 * Read the installed packages
262 */
263static int
264swins_get_packages(void)
265{
266 struct stat sb;
267 DIR *p_dir;
268 struct dirent *ent;
269 struct tm k_ts;
277 entry->type = (int32_t)SWI_OPERATING_SYSTEM;
278 memset(entry->date, 0, sizeof(entry->date));
279
280 if (OS_getSystemInitialLoadParameters(&boot) == SNMP_ERR_NOERROR &&
281 strlen(boot) > 0 && stat(boot, &sb) == 0 &&
282 localtime_r(&sb.st_ctime, &k_ts) != NULL)
283 entry->date_len = make_date_time(entry->date, &k_ts, 0);
284}
285
286/**
287 * Read the installed packages
288 */
289static int
290swins_get_packages(void)
291{
292 struct stat sb;
293 DIR *p_dir;
294 struct dirent *ent;
295 struct tm k_ts;
270 char *pkg_file;
296 char *pkg_file;
271 struct swins_entry *entry;
272 int ret = 0;
273
274 if (pkg_dir == NULL)
275 /* initialisation may have failed */
276 return (-1);
277
278 if (stat(pkg_dir, &sb) != 0) {

--- 11 unchanged lines hidden (view full) ---

290 "directory time-stamp unmodified");
291
292 TAILQ_FOREACH(entry, &swins_tbl, link)
293 entry->flags |= HR_SWINSTALLED_FOUND;
294
295 return (0);
296 }
297
297 struct swins_entry *entry;
298 int ret = 0;
299
300 if (pkg_dir == NULL)
301 /* initialisation may have failed */
302 return (-1);
303
304 if (stat(pkg_dir, &sb) != 0) {

--- 11 unchanged lines hidden (view full) ---

316 "directory time-stamp unmodified");
317
318 TAILQ_FOREACH(entry, &swins_tbl, link)
319 entry->flags |= HR_SWINSTALLED_FOUND;
320
321 return (0);
322 }
323
298 if ((p_dir = opendir(pkg_dir)) == NULL) {
299 syslog(LOG_ERR, "hrSWInstalledTable: opendir(\"%s\") failed: "
324 if ((p_dir = opendir(pkg_dir)) == NULL) {
325 syslog(LOG_ERR, "hrSWInstalledTable: opendir(\"%s\") failed: "
300 "%m", pkg_dir);
301 return (-1);
326 "%m", pkg_dir);
327 return (-1);
302 }
328 }
303
304 while (errno = 0, (ent = readdir(p_dir)) != NULL) {
329
330 while (errno = 0, (ent = readdir(p_dir)) != NULL) {
305 HRDBG(" pkg file: %s", ent->d_name);
331 HRDBG(" pkg file: %s", ent->d_name);
306
307 /* check that the contents file is a regular file */
332
333 /* check that the contents file is a regular file */
308 if (asprintf(&pkg_file, "%s/%s/%s", pkg_dir, ent->d_name,
334 if (asprintf(&pkg_file, "%s/%s/%s", pkg_dir, ent->d_name,
309 CONTENTS_FNAME) == -1)
310 continue;
311
335 CONTENTS_FNAME) == -1)
336 continue;
337
312 if (stat(pkg_file, &sb) != 0 ) {
338 if (stat(pkg_file, &sb) != 0 ) {
313 free(pkg_file);
339 free(pkg_file);
314 continue;
340 continue;
315 }
316
317 if (!S_ISREG(sb.st_mode)) {
318 syslog(LOG_ERR, "hrSWInstalledTable: \"%s\" not a "
319 "regular file -- skipped", pkg_file);
320 free(pkg_file);
321 continue;
322 }

--- 6 unchanged lines hidden (view full) ---

329 if (stat(pkg_file, &sb) == -1 ||
330 localtime_r(&sb.st_ctime, &k_ts) == NULL) {
331 free(pkg_file);
332 continue;
333 }
334 free(pkg_file);
335
336 /* update or create entry */
341 }
342
343 if (!S_ISREG(sb.st_mode)) {
344 syslog(LOG_ERR, "hrSWInstalledTable: \"%s\" not a "
345 "regular file -- skipped", pkg_file);
346 free(pkg_file);
347 continue;
348 }

--- 6 unchanged lines hidden (view full) ---

355 if (stat(pkg_file, &sb) == -1 ||
356 localtime_r(&sb.st_ctime, &k_ts) == NULL) {
357 free(pkg_file);
358 continue;
359 }
360 free(pkg_file);
361
362 /* update or create entry */
337 if ((entry = swins_find_by_name(ent->d_name)) == NULL &&
338 (entry = swins_entry_create(ent->d_name)) == NULL) {
363 if ((entry = swins_find_by_name(ent->d_name)) == NULL &&
364 (entry = swins_entry_create(ent->d_name)) == NULL) {
339 ret = -1;
365 ret = -1;
340 goto PKG_LOOP_END;
366 goto PKG_LOOP_END;
341 }
342
343 entry->flags |= HR_SWINSTALLED_FOUND;
367 }
368
369 entry->flags |= HR_SWINSTALLED_FOUND;
344 entry->id = oid_zeroDotZero;
370 entry->id = &oid_zeroDotZero;
345 entry->type = (int32_t)SWI_APPLICATION;
346
347 entry->date_len = make_date_time(entry->date, &k_ts, 0);
348 }
349
350 if (errno != 0) {
351 syslog(LOG_ERR, "hrSWInstalledTable: readdir_r(\"%s\") failed:"
352 " %m", pkg_dir);
353 ret = -1;
354 } else {
355 /*
356 * save the timestamp of directory
371 entry->type = (int32_t)SWI_APPLICATION;
372
373 entry->date_len = make_date_time(entry->date, &k_ts, 0);
374 }
375
376 if (errno != 0) {
377 syslog(LOG_ERR, "hrSWInstalledTable: readdir_r(\"%s\") failed:"
378 " %m", pkg_dir);
379 ret = -1;
380 } else {
381 /*
382 * save the timestamp of directory
357 * to avoid any further scanning
383 * to avoid any further scanning
358 */
359 os_pkg_last_change = sb.st_ctime;
360 }
361 PKG_LOOP_END:
362 (void)closedir(p_dir);
363 return (ret);
364}
365

--- 28 unchanged lines hidden (view full) ---

394
395/**
396 * Create and populate the package table
397 */
398void
399init_swins_tbl(void)
400{
401
384 */
385 os_pkg_last_change = sb.st_ctime;
386 }
387 PKG_LOOP_END:
388 (void)closedir(p_dir);
389 return (ret);
390}
391

--- 28 unchanged lines hidden (view full) ---

420
421/**
422 * Create and populate the package table
423 */
424void
425init_swins_tbl(void)
426{
427
402 if ((pkg_dir = malloc(sizeof(PATH_PKGDIR))) == NULL) {
428 if ((pkg_dir = malloc(sizeof(PATH_PKGDIR))) == NULL)
403 syslog(LOG_ERR, "%s: %m", __func__);
429 syslog(LOG_ERR, "%s: %m", __func__);
404 } else
430 else
405 strcpy(pkg_dir, PATH_PKGDIR);
406
407 swins_get_OS_ident();
408 refresh_swins_tbl();
409
410 HRDBG("init done");
411}
412

--- 28 unchanged lines hidden (view full) ---

441 case SNMP_OP_SET:
442 if ((entry = FIND_OBJECT_INT(&swins_tbl,
443 &value->var, sub)) == NULL)
444 return (SNMP_ERR_NO_CREATION);
445 return (SNMP_ERR_NOT_WRITEABLE);
446
447 case SNMP_OP_ROLLBACK:
448 case SNMP_OP_COMMIT:
431 strcpy(pkg_dir, PATH_PKGDIR);
432
433 swins_get_OS_ident();
434 refresh_swins_tbl();
435
436 HRDBG("init done");
437}
438

--- 28 unchanged lines hidden (view full) ---

467 case SNMP_OP_SET:
468 if ((entry = FIND_OBJECT_INT(&swins_tbl,
469 &value->var, sub)) == NULL)
470 return (SNMP_ERR_NO_CREATION);
471 return (SNMP_ERR_NOT_WRITEABLE);
472
473 case SNMP_OP_ROLLBACK:
474 case SNMP_OP_COMMIT:
449 abort();
475 abort();
450 }
451 abort();
452
453 get:
454 switch (value->var.subs[sub - 1]) {
455
456 case LEAF_hrSWInstalledIndex:
457 value->v.integer = entry->index;
458 return (SNMP_ERR_NOERROR);
459
460 case LEAF_hrSWInstalledName:
476 }
477 abort();
478
479 get:
480 switch (value->var.subs[sub - 1]) {
481
482 case LEAF_hrSWInstalledIndex:
483 value->v.integer = entry->index;
484 return (SNMP_ERR_NOERROR);
485
486 case LEAF_hrSWInstalledName:
461 return (string_get(value, entry->name, -1));
462 break;
487 return (string_get(value, entry->name, -1));
488 break;
463
489
464 case LEAF_hrSWInstalledID:
465 value->v.oid = entry->id;
466 return (SNMP_ERR_NOERROR);
490 case LEAF_hrSWInstalledID:
491 assert(entry->id != NULL);
492 value->v.oid = *entry->id;
493 return (SNMP_ERR_NOERROR);
467
468 case LEAF_hrSWInstalledType:
494
495 case LEAF_hrSWInstalledType:
469 value->v.integer = entry->type;
470 return (SNMP_ERR_NOERROR);
496 value->v.integer = entry->type;
497 return (SNMP_ERR_NOERROR);
471
472 case LEAF_hrSWInstalledDate:
473 return (string_get(value, entry->date, entry->date_len));
474 }
475 abort();
476}
477
478/**

--- 50 unchanged lines hidden ---
498
499 case LEAF_hrSWInstalledDate:
500 return (string_get(value, entry->date, entry->date_len));
501 }
502 abort();
503}
504
505/**

--- 50 unchanged lines hidden ---