Mergre from f27

This commit is contained in:
Josef Ridky 2018-02-16 08:13:39 +01:00
commit faa1c9c26f
5 changed files with 212 additions and 13 deletions

View File

@ -0,0 +1,28 @@
From 9432f629e66e4f9500f6335eab3ad427f84523b2 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Thu, 20 Jul 2017 10:31:47 -0700
Subject: [PATCH] Link libnetsnmptrapd against MYSQL_LIBS
When building with MySQL (MariaDB) support, this library must
be linked against the MySQL client library, or else it will
have unresolved symbols.
---
apps/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apps/Makefile.in b/apps/Makefile.in
index 77404dd89..7da434522 100644
--- a/apps/Makefile.in
+++ b/apps/Makefile.in
@@ -204,7 +204,7 @@ snmpdf$(EXEEXT): snmpdf.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmpdf.$(OSUFFIX) ${LDFLAGS} ${LIBS}
libnetsnmptrapd.$(LIB_EXTENSION)$(LIB_VERSION): $(LLIBTRAPD_OBJS)
- $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS)
+ $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(MYSQL_LIBS)
$(RANLIB) $@
snmpinforminstall:
--
2.13.0

View File

@ -82,10 +82,10 @@ diff -up net-snmp-5.7.3/agent/snmpd.c.MPGqYh net-snmp-5.7.3/agent/snmpd.c
#endif
#ifndef WIN32
+#ifndef NETSNMP_NO_SYSYSTEMD
+#ifndef NETSNMP_NO_SYSTEMD
+ /* check if systemd has sockets for us and don't close them */
+ prepared_sockets = netsnmp_sd_listen_fds(0);
+#endif /* NETSNMP_NO_SYSYSTEMD */
+#endif /* NETSNMP_NO_SYSTEMD */
+
/*
* close all non-standard file descriptors we may have

View File

@ -0,0 +1,38 @@
diff -urNp old/apps/snmptrapd_sql.c new/apps/snmptrapd_sql.c
--- old/apps/snmptrapd_sql.c 2017-07-18 09:44:00.655109694 +0200
+++ new/apps/snmptrapd_sql.c 2017-07-19 12:51:14.836148821 +0200
@@ -54,6 +54,7 @@
#include <my_sys.h>
#include <mysql.h>
#include <errmsg.h>
+#include <mysql_version.h>
netsnmp_feature_require(container_fifo)
@@ -437,6 +438,7 @@ netsnmp_mysql_init(void)
return -1;
}
+#if MYSQL_VERSION_ID < 100000
#ifdef HAVE_BROKEN_LIBMYSQLCLIENT
my_init();
#else
@@ -445,6 +447,7 @@ netsnmp_mysql_init(void)
/** load .my.cnf values */
load_defaults ("my", _sql.groups, &not_argc, &not_argv);
+#endif
for(i=0; i < not_argc; ++i) {
if (NULL == not_argv[i])
continue;
@@ -542,6 +545,10 @@ netsnmp_mysql_init(void)
return -1;
}
+#if MYSQL_VERSION_ID > 100000
+ mysql_options(_sql.conn, MYSQL_READ_DEFAULT_GROUP, "snmptrapd");
+#endif
+
/** try to connect; we'll try again later if we fail */
(void) netsnmp_mysql_connect();

View File

@ -0,0 +1,90 @@
diff -uNr net-snmp-5.7.3.orig/agent/mibgroup/host/data_access/swinst_rpm.c net-snmp-5.7.3/agent/mibgroup/host/data_access/swinst_rpm.c
--- net-snmp-5.7.3.orig/agent/mibgroup/host/data_access/swinst_rpm.c 2014-12-08 21:23:22.000000000 +0100
+++ net-snmp-5.7.3/agent/mibgroup/host/data_access/swinst_rpm.c 2017-08-11 00:16:35.232470439 +0200
@@ -96,8 +96,7 @@
rpmdbMatchIterator mi;
Header h;
- char *n, *v, *r, *g;
- int32_t *t;
+ const char *n, *v, *r, *g;
time_t install_time;
size_t date_len;
int i = 1;
@@ -119,11 +118,11 @@
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);
+ n = headerGetString( h, RPMTAG_NAME);
+ v = headerGetString( h, RPMTAG_VERSION);
+ r = headerGetString( h, RPMTAG_RELEASE);
+ g = headerGetString( h, RPMTAG_GROUP);
+ install_time = headerGetNumber( h, RPMTAG_INSTALLTIME);
entry->swName_len = snprintf( entry->swName, sizeof(entry->swName),
"%s-%s-%s", n, v, r);
@@ -133,7 +132,6 @@
? 2 /* operatingSystem */
: 4; /* application */
- install_time = *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);
diff -uNr net-snmp-5.7.3.orig/agent/mibgroup/host/hr_swinst.c net-snmp-5.7.3/agent/mibgroup/host/hr_swinst.c
--- net-snmp-5.7.3.orig/agent/mibgroup/host/hr_swinst.c 2014-12-08 21:23:22.000000000 +0100
+++ net-snmp-5.7.3/agent/mibgroup/host/hr_swinst.c 2017-08-11 00:17:07.488544492 +0200
@@ -484,9 +484,9 @@
}
#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 )
+ const char *rpm_group = headerGetString(swi->swi_h, RPMTAG_GROUP);
+ if ( NULL != rpm_group ) {
+ if ( strstr(rpm_group, "System Environment") != NULL )
long_return = 2; /* operatingSystem */
else
long_return = 4; /* applcation */
@@ -503,9 +503,8 @@
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;
+ time_t installTime = headerGetNumber(swi->swi_h, RPMTAG_INSTALLTIME);
+ if ( 0 != installTime) {
ret = date_n_time(&installTime, var_len);
} else {
ret = date_n_time(NULL, var_len);
@@ -665,7 +664,7 @@
if (1 <= ix && ix <= swi->swi_nrec && ix != swi->swi_prevx) {
int offset;
Header h;
- char *n, *v, *r;
+ const char *n, *v, *r;
offset = swi->swi_recs[ix - 1];
@@ -690,11 +689,9 @@
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);
+ n = headerGetString(swi->swi_h, RPMTAG_NAME);
+ v = headerGetString(swi->swi_h, RPMTAG_VERSION);
+ r = headerGetString(swi->swi_h, RPMTAG_RELEASE);
snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", n, v, r);
swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
}

View File

@ -11,7 +11,7 @@
Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp
Version: 5.7.3
Release: 17%{?dist}
Release: 26%{?dist}
Epoch: 1
License: BSD
@ -51,13 +51,25 @@ Patch14: net-snmp-5.7.3-Remove-U64-typedef.patch
Patch15: net-snmp-5.7.3-Fix-Makefile-PL.patch
# Use strtok_r for strtok to avoid a race condition
Patch16: net-snmp-5.7.3-strtok-r.patch
# Fix perl issue with use NetSNMP::TrapReceiver (add link to libmysqlclient.so)
Patch17: net-snmp-5.7.3-mysqllib.patch
# Fix build with MariaDB 10.2
# https://sourceforge.net/p/net-snmp/bugs/2782/
# Josef's patch from https://sourceforge.net/p/net-snmp/bugs/2782/#cbed
# but with the config_os_libs2 portion removed
Patch17: net-snmp-5.7.3-mariadb102.patch
# Fix issue with undefined symbol my_progname when try to load
# NetSNMP::TrapReceiver in perl script (#1470004)
# https://sourceforge.net/p/net-snmp/bugs/2792/
# https://sourceforge.net/p/net-snmp/bugs/2792/attachment/0001-Link-libnetsnmptrapd-against-MYSQL_LIBS.patch
# (rebased on 5.7.3)
Patch18: 0001-Link-libnetsnmptrapd-against-MYSQL_LIBS.patch
# This patch fix issue with new OpenSLL library in rawhide (f26+)
# !!!WARNING!!! DO NOT USE IT FOR OLDER FEDORA RELEASES (>f26)
Patch100: net-snmp-5.7.3-openssl.patch
# Modern RPM API means at least EL6
Patch101: net-snmp-5.7.3-modern-rpm-api.patch
Requires(post): chkconfig
Requires(preun): chkconfig
# for /sbin/service
@ -74,7 +86,7 @@ Requires(post): systemd-sysv
BuildRequires: openssl-devel, bzip2-devel, elfutils-devel
BuildRequires: libselinux-devel, elfutils-libelf-devel, rpm-devel
BuildRequires: perl-devel, perl(ExtUtils::Embed), procps
BuildRequires: python-devel, python-setuptools
BuildRequires: python2-devel, python2-setuptools
BuildRequires: chrpath
BuildRequires: mysql-devel
# for netstat, needed by 'make test'
@ -143,9 +155,9 @@ packages installed.
%package perl
Group: Development/Libraries
Summary: The perl NET-SNMP module and the mib2c tool
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}, perl
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}, perl-interpreter
Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
BuildRequires: perl
BuildRequires: perl-interpreter
BuildRequires: perl-generators
%description perl
@ -230,8 +242,10 @@ cp %{SOURCE12} .
%patch14 -p1 -b .U64
%patch15 -p1 -b .make
%patch16 -p1 -b .strtok-r
%patch17 -p1 -b .mysqllib
%patch17 -p1 -b .mariadb102
%patch18 -p1 -b .perlfix
%patch100 -p1 -b .openssl
%patch101 -p1 -b .modern-rpm-api
%ifarch sparc64 s390 s390x
# disable failing test - see https://bugzilla.redhat.com/show_bug.cgi?id=680697
@ -539,11 +553,40 @@ rm -rf ${RPM_BUILD_ROOT}
%endif
%changelog
* Wed Jul 26 2017 Josef Ridky <jridky@redhat.com> - 1:5.7.3-17
- Change mysqllib patch for version posted to upstream (#1470004)
* Fri Feb 16 2018 Josef Ridky <jridky@redhat.com> - 1:5.7.3-26
- Fix issue in systemd patch (#1545946)
* Thu Jul 13 2017 Josef Ridky <jridky@redhat.com> - 1:5.7.3-16
- Fix perl issue with use NetSNMP::TrapReceiver (add link to libmysqlclient.so) (#1470004)
* Fri Aug 11 2017 Igor Gnatenko <ignatenko@redhat.com> - 1:5.7.3-25
- Rebuilt after RPM update (№ 3)
* Thu Aug 10 2017 Igor Gnatenko <ignatenko@redhat.com> - 1:5.7.3-24
- Rebuilt for RPM soname bump
* Thu Aug 10 2017 Igor Gnatenko <ignatenko@redhat.com> - 1:5.7.3-23
- Rebuilt for RPM soname bump
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1:5.7.3-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1:5.7.3-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Thu Jul 20 2017 Adam Williamson <awilliam@redhat.com> -1:5.7.3-20
- Edit fix of issue with undefined symbol my_progname when try to load
NetSNMP::TrapReceiver in perl script (#1470004)
* Thu Jul 20 2017 Josef Ridky <jridky@redhat.com> - 1:5.7.3-19
- Fix issue with undefined symbol my_progname when try to load NetSNMP::TrapReceiver in perl script. (#1470004)
* Wed Jul 19 2017 Adam Williamson <awilliam@redhat.com> - 1:5.7.3-18
- Fix build with MariaDB 10.2
* Thu Jul 13 2017 Petr Pisar <ppisar@redhat.com> - 1:5.7.3-17
- perl dependency renamed to perl-interpreter
<https://fedoraproject.org/wiki/Changes/perl_Package_to_Install_Core_Modules>
* Sun Jun 04 2017 Jitka Plesnikova <jplesnik@redhat.com> - 1:5.7.3-16
- Perl 5.26 rebuild
* Wed Feb 15 2017 Josef Ridky <jridky@redhat.com> - 1:5.7.3-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild