diff --git a/net-snmp-5.7.1-fix-handling-of-large-filesystems.patch b/net-snmp-5.7.1-fix-handling-of-large-filesystems.patch new file mode 100644 index 0000000..41138b7 --- /dev/null +++ b/net-snmp-5.7.1-fix-handling-of-large-filesystems.patch @@ -0,0 +1,47 @@ +commit 76ff25d9bf97579e7213102065fd5096f049a4c5 +Author: Bart Van Assche +Date: Fri Oct 7 14:13:18 2011 +0200 + + CHANGES: snmpd: HOST-RESOURCES-MIB::hrStorageTable: fix bug in handling large filesystems, where large means above 8 TB (= 2**31 * 4096 bytes). + + This patch fixes a bug introduced in commit + 71d8293f387a6cd66bb0dbb13c0f50174d2e678b. + For the original bug report, see also + https://sourceforge.net/tracker/?func=detail&atid=112694&aid=3419825&group_id=12694. + +diff --git a/agent/mibgroup/hardware/fsys/hw_fsys.c b/agent/mibgroup/hardware/fsys/hw_fsys.c +index c96284e..be698b2 100644 +--- a/agent/mibgroup/hardware/fsys/hw_fsys.c ++++ b/agent/mibgroup/hardware/fsys/hw_fsys.c +@@ -321,19 +321,23 @@ netsnmp_fsys_avail( netsnmp_fsys_info *f) { + + /* recalculate f->size_32, used_32, avail_32 and units_32 from f->size & comp.*/ + void +-netsnmp_fsys_calculate32( netsnmp_fsys_info *f) ++netsnmp_fsys_calculate32(netsnmp_fsys_info *f) + { + unsigned long long s = f->size; +- unsigned long long u = f->units; +- int factor = 0; ++ unsigned shift = 0; ++ + while (s > INT32_MAX) { + s = s >> 1; +- u = u << 1; +- factor++; ++ shift++; + } + + f->size_32 = s; +- f->units_32 = u; +- f->avail_32 = f->avail << factor; +- f->used_32 = f->used << factor; ++ f->units_32 = f->units << shift; ++ f->avail_32 = f->avail >> shift; ++ f->used_32 = f->used >> shift; ++ ++ DEBUGMSGTL(("fsys", "Results of 32-bit conversion: size %llu -> %lu;" ++ " units %llu -> %lu; avail %llu -> %lu; used %llu -> %lu\n", ++ f->size, f->size_32, f->units, f->units_32, ++ f->avail, f->avail_32, f->used, f->used_32)); + } diff --git a/net-snmp-5.7.1-fsys-memory-leak.patch b/net-snmp-5.7.1-fsys-memory-leak.patch new file mode 100644 index 0000000..1f65555 --- /dev/null +++ b/net-snmp-5.7.1-fsys-memory-leak.patch @@ -0,0 +1,21 @@ +commit 6ef6907642247c663b9b8964b9fd44a211dbcaa7 +Author: Bart Van Assche +Date: Thu Oct 20 20:30:54 2011 +0200 + + CHANGES: snmpd: BUG: 3408398: Fix a memory leak in agent/mibgroup/hardware/fsys. + + This memory leak was introduced via commit + 9bf3d96d96a8ecd4a5fc35c326dc937467002b6c: Initial HAL + implementation of FileSystem information (March 7, 2008). + +diff --git a/agent/mibgroup/hardware/fsys/fsys_getfsstats.c b/agent/mibgroup/hardware/fsys/fsys_getfsstats.c +index 55327b7..3cc9bc5 100644 +--- a/agent/mibgroup/hardware/fsys/fsys_getfsstats.c ++++ b/agent/mibgroup/hardware/fsys/fsys_getfsstats.c +@@ -175,4 +175,6 @@ netsnmp_fsys_arch_load( void ) + } + netsnmp_fsys_calculate32(entry); + } ++ ++ free(stats); + } diff --git a/net-snmp-5.7.1-old-api-double-free.patch b/net-snmp-5.7.1-old-api-double-free.patch new file mode 100644 index 0000000..ae05a38 --- /dev/null +++ b/net-snmp-5.7.1-old-api-double-free.patch @@ -0,0 +1,22 @@ +commit 5fd26e4fa3e000ea9c81c38ab975b7946efe2157 +Author: Bart Van Assche +Date: Wed Sep 28 17:49:55 2011 +0200 + + CHANGES: agent: Avoid that netsnmp_register_old_api() failure triggers a double free. + + Fixes a regression introduced via commit + aa4d47c2609e52818c9cdf1a8e2205de9a335a0a (svn r19515). + +diff --git a/agent/helpers/old_api.c b/agent/helpers/old_api.c +index b1630e6..2d710b0 100644 +--- a/agent/helpers/old_api.c ++++ b/agent/helpers/old_api.c +@@ -127,7 +127,7 @@ netsnmp_register_old_api(const char *moduleName, + */ + if (netsnmp_register_handler(reginfo) != MIB_REGISTERED_OK) { + /** netsnmp_handler_registration_free(reginfo); already freed */ +- SNMP_FREE(vp); ++ /* SNMP_FREE(vp); already freed */ + } + } + return SNMPERR_SUCCESS; diff --git a/net-snmp-5.7.1-snmplib-default-retries.patch b/net-snmp-5.7.1-snmplib-default-retries.patch new file mode 100644 index 0000000..8c0b82e --- /dev/null +++ b/net-snmp-5.7.1-snmplib-default-retries.patch @@ -0,0 +1,23 @@ +commit cf82b894b2217c26edc6f1356351c932415604e2 +Author: Bart Van Assche +Date: Sat Oct 15 14:45:08 2011 +0200 + + CHANGES: snmplib: BUG: 3423915: Change default number of retries back from 0 to 5 + + This patch fixes a bug introduced via commit 6cac050 (May 5, 2011, + added support for specifying the default number of retries in + snmpd.conf). + +diff --git a/snmplib/snmp_api.c b/snmplib/snmp_api.c +index 980b6f8..61cfa39 100644 +--- a/snmplib/snmp_api.c ++++ b/snmplib/snmp_api.c +@@ -704,6 +704,8 @@ _init_snmp(void) + + netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, + NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH, 16); ++ netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES, ++ DEFAULT_RETRIES); + + #ifdef NETSNMP_USE_REVERSE_ASNENCODING + netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, diff --git a/net-snmp-5.7.1-snmplib-zero-timeout.patch b/net-snmp-5.7.1-snmplib-zero-timeout.patch new file mode 100644 index 0000000..08879ce --- /dev/null +++ b/net-snmp-5.7.1-snmplib-zero-timeout.patch @@ -0,0 +1,22 @@ +commit 1421924b4852142192c5bb9e93ddbfed69e908fa +Author: Bart Van Assche +Date: Wed Sep 21 22:20:08 2011 +0200 + + CHANGES: snmplib: Avoid waiting indefinitely if a session has timeout zero + +diff --git a/snmplib/snmp_api.c b/snmplib/snmp_api.c +index df0dc1c..980b6f8 100644 +--- a/snmplib/snmp_api.c ++++ b/snmplib/snmp_api.c +@@ -6032,8 +6032,9 @@ snmp_sess_select_info2_flags(void *sessp, + */ + requests++; + for (rp = slp->internal->requests; rp; rp = rp->next_request) { +- if ((!timerisset(&earliest) +- || (timercmp(&rp->expire, &earliest, <)))) { ++ if (!timerisset(&earliest) ++ || (timerisset(&rp->expire) ++ && timercmp(&rp->expire, &earliest, <))) { + earliest = rp->expire; + DEBUGMSG(("verbose:sess_select","(to in %d.%06d sec) ", + (int)earliest.tv_sec, (int)earliest.tv_usec)); diff --git a/net-snmp-5.7.1-use-pclose-to-close-pipes.patch b/net-snmp-5.7.1-use-pclose-to-close-pipes.patch new file mode 100644 index 0000000..16c394f --- /dev/null +++ b/net-snmp-5.7.1-use-pclose-to-close-pipes.patch @@ -0,0 +1,19 @@ +commit 97172b311d20f4441c7a7e90092b59c1e0da99f7 +Author: Thomas Jarosch +Date: Wed Oct 5 08:46:39 2011 +0200 + + CHANGES: PATCH: 3418649: HOST-RESOURCES-MIB: Use pclose() instead of fclose() to close a pipe. + +diff --git a/agent/mibgroup/host/data_access/swinst_apt.c b/agent/mibgroup/host/data_access/swinst_apt.c +index d204857..a562faf 100644 +--- a/agent/mibgroup/host/data_access/swinst_apt.c ++++ b/agent/mibgroup/host/data_access/swinst_apt.c +@@ -95,7 +95,7 @@ netsnmp_swinst_arch_load( netsnmp_container *container, u_int flags) + entry->swDate_len = 8; + memcpy(entry->swDate, "\0\0\1\1\0\0\0\0", 8); + } +- fclose(p); ++ pclose(p); + DEBUGMSGTL(("swinst:load:arch"," loaded %d entries\n", + CONTAINER_SIZE(container))); + diff --git a/net-snmp.changes b/net-snmp.changes index b10d4b7..facbe20 100644 --- a/net-snmp.changes +++ b/net-snmp.changes @@ -1,3 +1,19 @@ +------------------------------------------------------------------- +Fri Oct 21 12:30:29 UTC 2011 - lchiquitto@suse.com + +- net-snmp-5.7.1-fsys-memory-leak.patch: fix a memory leak in + agent/mibgroup/hardware/fsys (bnc#725766) +- net-snmp-5.7.1-snmplib-default-retries.patch: change default + number of retries back from 0 to 5 (bnc#725766) +- net-snmp-5.7.1-fix-handling-of-large-filesystems.patch: fix + bug in handling large (>8TB) filesystems (bnc#725766) +- net-snmp-5.7.1-use-pclose-to-close-pipes.patch: use pclose() + instead of fclose() to close a pipe (bnc#725766) +- net-snmp-5.7.1-old-api-double-free.patch: agent: avoid double + free when netsnmp_register_old_api() fails (bnc#725766) +- net-snmp-5.7.1-snmplib-zero-timeout.patch: snmplib: avoid + waiting indefinitely if a session has timeout zero (bnc#725766) + ------------------------------------------------------------------- Thu Sep 29 00:44:40 UTC 2011 - lchiquitto@suse.com diff --git a/net-snmp.spec b/net-snmp.spec index ba68744..637d974 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -63,6 +63,12 @@ Patch6: net-snmp-5.5.0-perl-tk-warning.patch Patch7: net-snmp-5.7.0-velocity-mib.patch Patch8: net-snmp-5.7.0-recognize-reiserfs.patch Patch9: net-snmp-5.7.1-agentx-crash.patch +Patch10: net-snmp-5.7.1-snmplib-zero-timeout.patch +Patch11: net-snmp-5.7.1-old-api-double-free.patch +Patch12: net-snmp-5.7.1-use-pclose-to-close-pipes.patch +Patch13: net-snmp-5.7.1-fix-handling-of-large-filesystems.patch +Patch14: net-snmp-5.7.1-snmplib-default-retries.patch +Patch15: net-snmp-5.7.1-fsys-memory-leak.patch # Summary: SNMP Daemon @@ -205,6 +211,12 @@ Authors: %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 %build MIBS="misc/ipfwacc ucd-snmp/diskio etherlike-mib rmon-mib velocity smux \