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

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