Blame SOURCES/net-snmp-5.8-modern-rpm-api.patch

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