Submitted By: Mario Fetka (mario dot fetka at gmail dot com)
Date: 2008-11-04
Initial Package Version: 5.4.1.1
Origin: http://wraptastic.org/pub/jbj/rpm514-netsnmp-5.4.1.1.patch
Upstream Status: unknown
Description: hack to compile against rpm 5.1
 
diff -Naur net-snmp-5.4.1.1.orig/agent/mibgroup/host/hr_swinst.c net-snmp-5.4.1.1/agent/mibgroup/host/hr_swinst.c
--- net-snmp-5.4.1.1.orig/agent/mibgroup/host/hr_swinst.c	2006-12-12 23:55:46.000000000 +0000
+++ net-snmp-5.4.1.1/agent/mibgroup/host/hr_swinst.c	2008-11-03 23:19:29.305010591 +0000
@@ -41,8 +41,10 @@
 #endif
 
 #ifdef HAVE_LIBRPM
+#include <stdio.h>
+#include <stdint.h>
 #include <rpm/rpmlib.h>
-#include <rpm/header.h>
+#include <rpm/rpm4compat.h>
 #include <fcntl.h>
 
 #ifdef HAVE_RPMGETPATH
@@ -465,6 +467,7 @@
             if ( headerGetEntry(swi->swi_h, RPMTAG_INSTALLTIME, NULL, (void **) &rpm_data, NULL) ) {
                 time_t          installTime = *rpm_data;
                 ret = date_n_time(&installTime, var_len);
+		free((void *)rpm_data);
             } else {
                 ret = date_n_time(0, var_len);
             }
@@ -661,6 +664,9 @@
                        NULL);
         snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", n, v, r);
         swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
+	free((void *)n);
+	free((void *)v);
+	free((void *)r);
     }
 #else
     snprintf(swi->swi_name, sizeof(swi->swi_name), swi->swi_dep->d_name);
diff -Naur net-snmp-5.4.1.1.orig/configure.in net-snmp-5.4.1.1/configure.in
--- net-snmp-5.4.1.1.orig/configure.in	2008-05-14 00:49:57.000000000 +0000
+++ net-snmp-5.4.1.1/configure.in	2008-11-03 23:22:44.126003483 +0000
@@ -2760,12 +2760,12 @@
   fi
 ])
 
-AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
+AC_CHECK_HEADERS(rpm/rpmlib.h rpm/rpmtag.h)
 
 AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
-AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
+AC_CHECK_HEADER(rpm/rpmtag.h,rpmtag_h=yes,rpmtag_h=no)
 
-if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
+if test "x$rpmtag_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
   if test "x$with_rpm" = "xyes" ; then
     AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
   else