|
|
23ac29 |
diff -urNp a/agent/mibgroup/host/data_access/swinst_rpm.c b/agent/mibgroup/host/data_access/swinst_rpm.c
|
|
|
23ac29 |
--- a/agent/mibgroup/host/data_access/swinst_rpm.c 2018-07-18 16:12:19.583503903 +0200
|
|
|
23ac29 |
+++ b/agent/mibgroup/host/data_access/swinst_rpm.c 2018-07-18 16:50:38.599703588 +0200
|
|
|
23ac29 |
@@ -102,7 +102,6 @@ netsnmp_swinst_arch_load( netsnmp_contai
|
|
|
23ac29 |
rpmtd td_name, td_version, td_release, td_group, td_time;
|
|
|
23ac29 |
#else
|
|
|
23ac29 |
char *n, *v, *r, *g;
|
|
|
23ac29 |
- int32_t *t;
|
|
|
23ac29 |
#endif
|
|
|
23ac29 |
time_t install_time;
|
|
|
23ac29 |
size_t date_len;
|
|
|
23ac29 |
@@ -146,14 +145,13 @@ netsnmp_swinst_arch_load( netsnmp_contai
|
|
|
23ac29 |
install_time = rpmtdGetNumber(td_time);
|
|
|
23ac29 |
g = rpmtdGetString(td_group);
|
|
|
23ac29 |
#else
|
|
|
23ac29 |
- headerGetEntry( h, RPMTAG_NAME, NULL, (void**)&n, NULL);
|
|
|
23ac29 |
- headerGetEntry( h, RPMTAG_VERSION, NULL, (void**)&v, NULL);
|
|
|
23ac29 |
- headerGetEntry( h, RPMTAG_RELEASE, NULL, (void**)&r, NULL);
|
|
|
23ac29 |
- headerGetEntry( h, RPMTAG_GROUP, NULL, (void**)&g, NULL);
|
|
|
23ac29 |
- headerGetEntry( h, RPMTAG_INSTALLTIME, NULL, (void**)&t, NULL);
|
|
|
23ac29 |
+ n = headerGetString( h, RPMTAG_NAME);
|
|
|
23ac29 |
+ v = headerGetString( h, RPMTAG_VERSION);
|
|
|
23ac29 |
+ r = headerGetString( h, RPMTAG_RELEASE);
|
|
|
23ac29 |
+ g = headerGetString( h, RPMTAG_GROUP);
|
|
|
23ac29 |
+ install_time = headerGetNumber( h, RPMTAG_INSTALLTIME);
|
|
|
23ac29 |
entry->swName_len = snprintf( entry->swName, sizeof(entry->swName),
|
|
|
23ac29 |
"%s-%s-%s", n, v, r);
|
|
|
23ac29 |
- install_time = *t;
|
|
|
23ac29 |
#endif
|
|
|
23ac29 |
entry->swType = (g && NULL != strstr( g, "System Environment"))
|
|
|
23ac29 |
? 2 /* operatingSystem */
|
|
|
23ac29 |
diff -urNp a/agent/mibgroup/host/hr_swinst.c b/agent/mibgroup/host/hr_swinst.c
|
|
|
23ac29 |
--- a/agent/mibgroup/host/hr_swinst.c 2018-07-18 16:12:19.582503907 +0200
|
|
|
23ac29 |
+++ b/agent/mibgroup/host/hr_swinst.c 2018-07-18 17:09:29.716564197 +0200
|
|
|
23ac29 |
@@ -479,9 +479,9 @@ var_hrswinst(struct variable * vp,
|
|
|
23ac29 |
}
|
|
|
23ac29 |
#else
|
|
|
23ac29 |
# ifdef HAVE_LIBRPM
|
|
|
23ac29 |
- char *rpm_groups;
|
|
|
23ac29 |
- if ( headerGetEntry(swi->swi_h, RPMTAG_GROUP, NULL, (void **) &rpm_groups, NULL) ) {
|
|
|
23ac29 |
- if ( strstr(rpm_groups, "System Environment") != NULL )
|
|
|
23ac29 |
+ const char *rpm_group = headerGetString(swi->swi_h, RPMTAG_GROUP);
|
|
|
23ac29 |
+ if ( NULL != rpm_group ) {
|
|
|
23ac29 |
+ if ( strstr(rpm_group, "System Environment") != NULL )
|
|
|
23ac29 |
long_return = 2; /* operatingSystem */
|
|
|
23ac29 |
else
|
|
|
23ac29 |
long_return = 4; /* applcation */
|
|
|
23ac29 |
@@ -498,9 +498,8 @@ var_hrswinst(struct variable * vp,
|
|
|
23ac29 |
case HRSWINST_DATE:
|
|
|
23ac29 |
{
|
|
|
23ac29 |
#ifdef HAVE_LIBRPM
|
|
|
23ac29 |
- int32_t *rpm_data;
|
|
|
23ac29 |
- if ( headerGetEntry(swi->swi_h, RPMTAG_INSTALLTIME, NULL, (void **) &rpm_data, NULL) ) {
|
|
|
23ac29 |
- time_t installTime = *rpm_data;
|
|
|
23ac29 |
+ time_t installTime = headerGetNumber(swi->swi_h, RPMTAG_INSTALLTIME);
|
|
|
23ac29 |
+ if ( 0 != installTime ) {
|
|
|
23ac29 |
ret = date_n_time(&installTime, var_len);
|
|
|
23ac29 |
} else {
|
|
|
23ac29 |
ret = date_n_time(NULL, var_len);
|
|
|
23ac29 |
@@ -660,7 +659,7 @@ Save_HR_SW_info(int ix)
|
|
|
23ac29 |
if (1 <= ix && ix <= swi->swi_nrec && ix != swi->swi_prevx) {
|
|
|
23ac29 |
int offset;
|
|
|
23ac29 |
Header h;
|
|
|
23ac29 |
- char *n, *v, *r;
|
|
|
23ac29 |
+ const char *n, *v, *r;
|
|
|
23ac29 |
|
|
|
23ac29 |
offset = swi->swi_recs[ix - 1];
|
|
|
23ac29 |
|
|
|
23ac29 |
@@ -685,11 +684,9 @@ Save_HR_SW_info(int ix)
|
|
|
23ac29 |
swi->swi_h = h;
|
|
|
23ac29 |
swi->swi_prevx = ix;
|
|
|
23ac29 |
|
|
|
23ac29 |
- headerGetEntry(swi->swi_h, RPMTAG_NAME, NULL, (void **) &n, NULL);
|
|
|
23ac29 |
- headerGetEntry(swi->swi_h, RPMTAG_VERSION, NULL, (void **) &v,
|
|
|
23ac29 |
- NULL);
|
|
|
23ac29 |
- headerGetEntry(swi->swi_h, RPMTAG_RELEASE, NULL, (void **) &r,
|
|
|
23ac29 |
- NULL);
|
|
|
23ac29 |
+ n = headerGetString(swi->swi_h, RPMTAG_NAME);
|
|
|
23ac29 |
+ v = headerGetString(swi->swi_h, RPMTAG_VERSION);
|
|
|
23ac29 |
+ r = headerGetString(swi->swi_h, RPMTAG_RELEASE);
|
|
|
23ac29 |
snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", n, v, r);
|
|
|
23ac29 |
swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
|
|
|
23ac29 |
}
|