remove unused patch in net-snmp

The patch is not used, so delete it.

Story: 2003917
Task: 27000

Change-Id: I0fa70ffe64c41754bd10523a5526b0df1ed83a19
Signed-off-by: slin14 <shuicheng.lin@intel.com>
This commit is contained in:
slin14 2018-10-10 01:15:41 +08:00
parent 0844ed02bb
commit 031e47f314
3 changed files with 1 additions and 169 deletions

View File

@ -1,3 +1,3 @@
COPY_LIST="files/* patches/*"
COPY_LIST="files/*"
TIS_PATCH_VER=10
BUILD_IS_SLOW=3

View File

@ -1,20 +0,0 @@
diff --git a/net-snmp.spec b/net-snmp.spec
index f0c1d48..182265b 100644
--- a/SPECS/net-snmp.spec
+++ b/SPECS/net-snmp.spec
@@ -47,6 +47,7 @@ Source14: snmp.conf.cgcs
Patch1: net-snmp-5.7.2-pie.patch
Patch2: net-snmp-5.5-dir-fix.patch
Patch3: net-snmp-5.6-multilib.patch
+Patch4: 0001-rpm-headerGetEntry.patch
Patch5: net-snmp-5.6-test-debug.patch
Patch6: net-snmp-5.7.2-systemd.patch
Patch7: net-snmp-5.7.2-fips.patch
@@ -262,6 +263,7 @@ The net-snmp-sysvinit package provides SysV init scripts for Net-SNMP daemons.
%patch2 -p1 -b .dir-fix
%patch3 -p1 -b .multilib
+%patch4 -p1
%patch5 -p1
%patch6 -p1 -b .systemd
%patch7 -p1 -b .fips

View File

@ -1,148 +0,0 @@
diff --git a/agent/mibgroup/host/data_access/swinst_rpm.c b/agent/mibgroup/host/data_access/swinst_rpm.c
index 71595be..e12d3c8 100644
--- a/agent/mibgroup/host/data_access/swinst_rpm.c
+++ b/agent/mibgroup/host/data_access/swinst_rpm.c
@@ -96,14 +96,18 @@ netsnmp_swinst_arch_load( netsnmp_container *container, u_int flags)
rpmdbMatchIterator mi;
Header h;
- char *n, *v, *r, *g;
- int32_t *t;
+ rpmtd td_n, td_v, td_r, td_g, td_t;
time_t install_time;
size_t date_len;
int i = 1;
netsnmp_swinst_entry *entry;
ts = rpmtsCreate();
+ td_n = rpmtdNew();
+ td_v = rpmtdNew();
+ td_r = rpmtdNew();
+ td_g = rpmtdNew();
+ td_t = rpmtdNew();
rpmtsSetVSFlags( ts, (_RPMVSF_NOSIGNATURES|_RPMVSF_NODIGESTS));
mi = rpmtsInitIterator( ts, RPMDBI_PACKAGES, NULL, 0);
@@ -119,21 +123,21 @@ netsnmp_swinst_arch_load( netsnmp_container *container, u_int flags)
CONTAINER_INSERT(container, entry);
h = headerLink( h );
- headerGetEntry( h, RPMTAG_NAME, NULL, (void**)&n, NULL);
- headerGetEntry( h, RPMTAG_VERSION, NULL, (void**)&v, NULL);
- headerGetEntry( h, RPMTAG_RELEASE, NULL, (void**)&r, NULL);
- headerGetEntry( h, RPMTAG_GROUP, NULL, (void**)&g, NULL);
- headerGetEntry( h, RPMTAG_INSTALLTIME, NULL, (void**)&t, NULL);
+ headerGet( h, RPMTAG_NAME, td_n, HEADERGET_EXT);
+ headerGet( h, RPMTAG_VERSION, td_v, HEADERGET_EXT);
+ headerGet( h, RPMTAG_RELEASE, td_r, HEADERGET_EXT);
+ headerGet( h, RPMTAG_GROUP, td_g, HEADERGET_EXT);
+ headerGet( h, RPMTAG_INSTALLTIME, td_t, HEADERGET_EXT);
entry->swName_len = snprintf( entry->swName, sizeof(entry->swName),
- "%s-%s-%s", n, v, r);
+ "%s-%s-%s", rpmtdGetString(td_n), rpmtdGetString(td_v), rpmtdGetString(td_r));
if (entry->swName_len > sizeof(entry->swName))
entry->swName_len = sizeof(entry->swName);
- entry->swType = (NULL != strstr( g, "System Environment"))
+ entry->swType = (NULL != strstr( rpmtdGetString(td_g), "System Environment"))
? 2 /* operatingSystem */
: 4; /* application */
- install_time = *t;
+ install_time = rpmtdGetUint32(td_t);
dt = date_n_time( &install_time, &date_len );
if (date_len != 8 && date_len != 11) {
snmp_log(LOG_ERR, "Bogus length from date_n_time for %s", entry->swName);
@@ -148,6 +152,11 @@ netsnmp_swinst_arch_load( netsnmp_container *container, u_int flags)
}
rpmdbFreeIterator( mi );
rpmtsFree( ts );
+ rpmtdFree(td_t);
+ rpmtdFree(td_g);
+ rpmtdFree(td_r);
+ rpmtdFree(td_v);
+ rpmtdFree(td_n);
DEBUGMSGTL(("swinst:load:arch", "loaded %d entries\n",
(int)CONTAINER_SIZE(container)));
diff --git a/agent/mibgroup/host/hr_swinst.c b/agent/mibgroup/host/hr_swinst.c
index 4aa4593..643d3fe 100644
--- a/agent/mibgroup/host/hr_swinst.c
+++ b/agent/mibgroup/host/hr_swinst.c
@@ -484,15 +484,17 @@ var_hrswinst(struct variable * vp,
}
#else
# ifdef HAVE_LIBRPM
- char *rpm_groups;
- if ( headerGetEntry(swi->swi_h, RPMTAG_GROUP, NULL, (void **) &rpm_groups, NULL) ) {
- if ( strstr(rpm_groups, "System Environment") != NULL )
+ rpmtd td;
+ td = rpmtdNew();
+ if ( headerGet(swi->swi_h, RPMTAG_GROUP, td, HEADERGET_EXT) ) {
+ if ( strstr(rpmtdGetString(td), "System Environment") != NULL )
long_return = 2; /* operatingSystem */
else
long_return = 4; /* applcation */
} else {
long_return = 1; /* unknown */
}
+ rpmtdFree(td);
# else
long_return = 1; /* unknown */
# endif
@@ -503,13 +505,15 @@ var_hrswinst(struct variable * vp,
case HRSWINST_DATE:
{
#ifdef HAVE_LIBRPM
- int32_t *rpm_data;
- if ( headerGetEntry(swi->swi_h, RPMTAG_INSTALLTIME, NULL, (void **) &rpm_data, NULL) ) {
- time_t installTime = *rpm_data;
+ rpmtd td;
+ td = rpmtdNew();
+ if ( headerGet(swi->swi_h, RPMTAG_INSTALLTIME, td, HEADERGET_EXT) ) {
+ time_t installTime = rpmtdGetNumber(td);
ret = date_n_time(&installTime, var_len);
} else {
ret = date_n_time(NULL, var_len);
}
+ rpmtdFree(td);
#else
if (swi->swi_directory != NULL) {
snprintf(string, sizeof(string), "%s/%s",
@@ -662,7 +666,7 @@ Save_HR_SW_info(int ix)
if (1 <= ix && ix <= swi->swi_nrec && ix != swi->swi_prevx) {
int offset;
Header h;
- char *n, *v, *r;
+ rpmtd td_n, td_v, td_r;
offset = swi->swi_recs[ix - 1];
@@ -687,13 +691,21 @@ Save_HR_SW_info(int ix)
swi->swi_h = h;
swi->swi_prevx = ix;
- headerGetEntry(swi->swi_h, RPMTAG_NAME, NULL, (void **) &n, NULL);
- headerGetEntry(swi->swi_h, RPMTAG_VERSION, NULL, (void **) &v,
- NULL);
- headerGetEntry(swi->swi_h, RPMTAG_RELEASE, NULL, (void **) &r,
- NULL);
- snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", n, v, r);
+ td_n = rpmtdNew{};
+ td_v = rpmtdNew{};
+ td_r = rpmtdNew{};
+
+ headerGet(swi->swi_h, RPMTAG_NAME, td_n, HEADERGET_EXT);
+ headerGet(swi->swi_h, RPMTAG_VERSION, td_v, HEADERGET_EXT);
+ headerGet(swi->swi_h, RPMTAG_RELEASE, td_r, HEADERGET_EXT);
+
+ snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", rpmtdGetString(td_n), rpmtdGetNumber(td_v), rpmtdGetNumber(td_r));
swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
+
+ rpmtdFree(td_r);
+ rpmtdFree(td_v);
+ rpmtdFree(td_n);
+
}
#else
snprintf(swi->swi_name, sizeof(swi->swi_name), "%s", swi->swi_dep->d_name);