diff --git a/SOURCES/net-snmp-5.7.2-MYSQL-LIBS.patch b/SOURCES/net-snmp-5.7.2-MYSQL-LIBS.patch new file mode 100644 index 0000000..1ccf204 --- /dev/null +++ b/SOURCES/net-snmp-5.7.2-MYSQL-LIBS.patch @@ -0,0 +1,12 @@ +diff -urNp O/apps/Makefile.in N/apps/Makefile.in +--- O/apps/Makefile.in 2019-03-18 12:36:59.016177653 +0100 ++++ N/apps/Makefile.in 2019-03-18 12:38:55.731913867 +0100 +@@ -204,7 +204,7 @@ snmpdf$(EXEEXT): snmpdf.$(OSUFFIX) $( + $(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) ${LDFLAGS} ++ $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(MYSQL_LIBS) ${LDFLAGS} + $(RANLIB) $@ + + snmpinforminstall: diff --git a/SOURCES/net-snmp-5.7.2-expand-SNMPCONFPATH.patch b/SOURCES/net-snmp-5.7.2-expand-SNMPCONFPATH.patch new file mode 100644 index 0000000..9191772 --- /dev/null +++ b/SOURCES/net-snmp-5.7.2-expand-SNMPCONFPATH.patch @@ -0,0 +1,12 @@ +diff -urNp O/snmplib/read_config.c N/snmplib/read_config.c +--- O/snmplib/read_config.c 2019-03-19 09:24:32.154933465 +0100 ++++ N/snmplib/read_config.c 2019-03-19 09:25:26.651756802 +0100 +@@ -1633,7 +1633,7 @@ snmp_save_persistent(const char *type) + * save a warning header to the top of the new file + */ + snprintf(fileold, sizeof(fileold), +- "%s%s# Please save normal configuration tokens for %s in SNMPCONFPATH/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n%s", ++ "%s%s# Please save normal configuration tokens for %s in /etc/snmp/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n%s", + "#\n# net-snmp (or ucd-snmp) persistent data file.\n#\n############################################################################\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n", + "#\n# **** DO NOT EDIT THIS FILE ****\n#\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n############################################################################\n#\n# DO NOT STORE CONFIGURATION ENTRIES HERE.\n", + type, type, type, diff --git a/SOURCES/net-snmp-5.7.2-memory.patch b/SOURCES/net-snmp-5.7.2-memory.patch new file mode 100644 index 0000000..d353e70 --- /dev/null +++ b/SOURCES/net-snmp-5.7.2-memory.patch @@ -0,0 +1,53 @@ +diff -urNp c/agent/mibgroup/hardware/memory/memory_linux.c d/agent/mibgroup/hardware/memory/memory_linux.c +--- c/agent/mibgroup/hardware/memory/memory_linux.c 2019-04-10 14:07:47.375285001 +0200 ++++ d/agent/mibgroup/hardware/memory/memory_linux.c 2019-04-12 11:39:11.677314245 +0200 +@@ -29,7 +29,7 @@ int netsnmp_mem_arch_load( netsnmp_cache + ssize_t bytes_read; + char *b; + unsigned long memtotal = 0, memfree = 0, memshared = 0, +- buffers = 0, cached = 0, ++ buffers = 0, cached = 0, sreclaimable = 0, + swaptotal = 0, swapfree = 0; + + netsnmp_memory_info *mem; +@@ -126,6 +126,13 @@ int netsnmp_mem_arch_load( netsnmp_cache + if (first) + snmp_log(LOG_ERR, "No SwapTotal line in /proc/meminfo\n"); + } ++ b = strstr(buff, "SReclaimable: "); ++ if (b) ++ sscanf(b, "SReclaimable: %lu", &sreclaimable); ++ else { ++ if (first) ++ snmp_log(LOG_ERR, "No SReclaimable line in /proc/meminfo\n"); ++ } + b = strstr(buff, "SwapFree: "); + if (b) + sscanf(b, "SwapFree: %lu", &swapfree); +@@ -147,7 +154,7 @@ int netsnmp_mem_arch_load( netsnmp_cache + mem->descr = strdup("Physical memory"); + mem->units = 1024; + mem->size = memtotal; +- mem->free = memfree; ++ mem->free = memfree+buffers+cached+sreclaimable; + mem->other = -1; + } + +@@ -159,7 +166,7 @@ int netsnmp_mem_arch_load( netsnmp_cache + mem->descr = strdup("Virtual memory"); + mem->units = 1024; + mem->size = memtotal+swaptotal; +- mem->free = memfree +swapfree; ++ mem->free = memfree+swapfree+buffers+cached+sreclaimable; + mem->other = -1; + } + +@@ -182,7 +189,7 @@ int netsnmp_mem_arch_load( netsnmp_cache + if (!mem->descr) + mem->descr = strdup("Cached memory"); + mem->units = 1024; +- mem->size = cached; ++ mem->size = cached+sreclaimable; + mem->free = 0; /* Report cached size/used as equal */ + mem->other = -1; + } diff --git a/SOURCES/net-snmp-5.7.2-snmpd-log-once.patch b/SOURCES/net-snmp-5.7.2-snmpd-log-once.patch new file mode 100644 index 0000000..5825124 --- /dev/null +++ b/SOURCES/net-snmp-5.7.2-snmpd-log-once.patch @@ -0,0 +1,21 @@ +diff -urNp O/agent/mibgroup/hardware/fsys/fsys_mntctl.c N/agent/mibgroup/hardware/fsys/fsys_mntctl.c +--- O/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2019-03-18 12:22:21.655280129 +0100 ++++ N/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2019-03-18 12:24:38.481898394 +0100 +@@ -89,7 +89,6 @@ netsnmp_fsys_arch_load( void ) + char *path; + struct statfs stat_buf; + netsnmp_fsys_info *entry; +- char tmpbuf[1024]; + + /* + * Retrieve information about the currently mounted filesystems... +@@ -163,8 +162,7 @@ netsnmp_fsys_arch_load( void ) + continue; + + if ( statfs( entry->path, &stat_buf ) < 0 ) { +- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s\n", entry->path ); +- snmp_log_perror( tmpbuf ); ++ NETSNMP_LOGONCE(( LOG_ERROR, "Cannot statfs %s\n", entry->path )); + continue; + } + entry->units = stat_buf.f_bsize; diff --git a/SOURCES/net-snmp-5.7.2-traptomail.patch b/SOURCES/net-snmp-5.7.2-traptomail.patch new file mode 100644 index 0000000..09d2cc7 --- /dev/null +++ b/SOURCES/net-snmp-5.7.2-traptomail.patch @@ -0,0 +1,11 @@ +diff -urNp a/local/traptoemail b/local/traptoemail +--- a/local/traptoemail 2019-03-19 14:26:31.824021449 +0100 ++++ b/local/traptoemail 2019-03-19 14:30:38.917515164 +0100 +@@ -63,7 +63,6 @@ $message->to(@ARGV) || die "failed to se + $message->data(); + $message->datasend("To: " . join(", ",@ARGV) . "\n"); + $message->datasend("From: $opts{f}\n"); +-$message->datasend("Date: ".strftime("%a, %e %b %Y %X %z", localtime())."\n"); + $message->datasend("Subject: trap received from $hostname: $values[1]\n"); + $message->datasend("\n"); + $message->datasend("Host: $hostname ($ipaddress)\n"); diff --git a/SPECS/net-snmp.spec b/SPECS/net-snmp.spec index 0122eef..a6f8c91 100644 --- a/SPECS/net-snmp.spec +++ b/SPECS/net-snmp.spec @@ -11,7 +11,7 @@ Summary: A collection of SNMP protocol tools and libraries Name: net-snmp Version: 5.7.2 -Release: 38%{?dist}.2 +Release: 43%{?dist} Epoch: 1 License: BSD @@ -107,8 +107,13 @@ Patch71: net-snmp-5.7.2-fsync.patch Patch72: net-snmp-5.7.2-zfs-support.patch Patch73: net-snmp-5.7.2-man-page.patch Patch74: net-snmp-5.7.2-key-leak-backport.patch -Patch75: net-snmp-5.7.2-null-magic.patch -Patch76: net-snmp-5.7.2-v3-forward.patch +Patch75: net-snmp-5.7.2-snmpd-log-once.patch +Patch76: net-snmp-5.7.2-MYSQL-LIBS.patch +Patch77: net-snmp-5.7.2-expand-SNMPCONFPATH.patch +Patch78: net-snmp-5.7.2-traptomail.patch +Patch79: net-snmp-5.7.2-null-magic.patch +Patch80: net-snmp-5.7.2-v3-forward.patch +Patch81: net-snmp-5.7.2-memory.patch Requires(post): chkconfig Requires(preun): chkconfig @@ -336,8 +341,13 @@ The net-snmp-sysvinit package provides SysV init scripts for Net-SNMP daemons. %patch72 -p1 -b .zfs-support %patch73 -p1 -b .man-page %patch74 -p1 -b .key-bakcport -%patch75 -p1 -b .null-magic -%patch76 -p1 -b .v3-forward +%patch75 -p1 -b .snmpd-log-once +%patch76 -p1 -b .MYSQL-LIBS +%patch77 -p1 -b .expand-variable +%patch78 -p1 -b .traptomail +%patch79 -p1 -b .null-magic +%patch80 -p1 -b .v3-forward +%patch81 -p1 -b .memory %ifarch sparc64 s390 s390x # disable failing test - see https://bugzilla.redhat.com/show_bug.cgi?id=680697 @@ -633,11 +643,23 @@ rm -rf ${RPM_BUILD_ROOT} %{_initrddir}/snmptrapd %changelog -* Mon May 13 2019 Josef Ridky - 1:5.7.2-38.2 -- fix trapd crash when forward snmp v3 traps (#1709111) +* Wed May 22 2019 Josef Ridky - 1:5.7.2-43 +- fix available memory calculation (#1250060) -* Thu Apr 18 2019 Josef Ridky - 1:5.7.2-38.1 -- secure magic variable to prevent daemon crash (#1701211) +* Fri May 10 2019 Josef Ridky - 1:5.7.2-42 +- fix trapd crash when forward snmp v3 traps (#1680547) + +* Wed Apr 17 2019 Josef Ridky - 1:5.7.2-41 +- secure magic variable to prevent daemon crash (#1635201) + +* Fri Mar 29 2019 Josef Ridky - 1:5.7.2-40 +- add relro flag to MYSQL LIBS patch (#1548084) + +* Tue Mar 19 2019 Josef Ridky - 1:5.7.2-39 +- adjust logging of statfs (#1314610) +- link libnetsnmptrapd against MYSQL LIBS (#1468084) +- expand SNMPCONFPATH (#1514501) +- remove date in mailheader (#1585940) * Mon Nov 26 2018 Josef Ridky - 1:5.7.2-38 - backport upstream fixes of memory leaks (#1650393)