diff options
author | Peter Volkov <pva@gentoo.org> | 2007-12-27 17:15:33 +0000 |
---|---|---|
committer | Peter Volkov <pva@gentoo.org> | 2007-12-27 17:15:33 +0000 |
commit | 401731012bb83c8d4080487717ce9aa44c2d9d0e (patch) | |
tree | b2117c6b46c9426a01d3bbc0667603985e2f2168 /net-analyzer | |
parent | Added dev-tcltk/Tk_Theme for removal. (diff) | |
download | gentoo-2-401731012bb83c8d4080487717ce9aa44c2d9d0e.tar.gz gentoo-2-401731012bb83c8d4080487717ce9aa44c2d9d0e.tar.bz2 gentoo-2-401731012bb83c8d4080487717ce9aa44c2d9d0e.zip |
Fixes memory leaks reported in bug #180266, thank Doug <doug.manley AT gmail.com> for report and ivestigation. Added upstream patch to suppress annoying "registration != duplicate" warning for root oids.
(Portage version: 2.1.3.19)
Diffstat (limited to 'net-analyzer')
5 files changed, 268 insertions, 21 deletions
diff --git a/net-analyzer/net-snmp/ChangeLog b/net-analyzer/net-snmp/ChangeLog index f5cd6412a087..7678f243b826 100644 --- a/net-analyzer/net-snmp/ChangeLog +++ b/net-analyzer/net-snmp/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for net-analyzer/net-snmp # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/ChangeLog,v 1.162 2007/11/19 06:16:52 kumba Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/ChangeLog,v 1.163 2007/12/27 17:15:32 pva Exp $ + +*net-snmp-5.4.1-r2 (27 Dec 2007) + + 27 Dec 2007; <pva@gentoo.org> files/net-snmp-5.4.1-clientaddr-fix.patch, + +files/net-snmp-5.4.1-suppresssuppress-annoying.patch, + +net-snmp-5.4.1-r2.ebuild: + Fixes memory leaks reported in bug #180266, thank Doug <doug.manley AT + gmail.com> for report and ivestigation. Added upstream patch to suppress + annoying "registration != duplicate" warning for root oids. 19 Nov 2007; Joshua Kinard <kumba@gentoo.org> net-snmp-5.4.1-r1.ebuild: Marked unstable on mips, per #198346. diff --git a/net-analyzer/net-snmp/files/digest-net-snmp-5.4.1-r2 b/net-analyzer/net-snmp/files/digest-net-snmp-5.4.1-r2 new file mode 100644 index 000000000000..34865f92ea1e --- /dev/null +++ b/net-analyzer/net-snmp/files/digest-net-snmp-5.4.1-r2 @@ -0,0 +1,3 @@ +MD5 6c974df7a5a5b1579f72115e6b045bda net-snmp-5.4.1.tar.gz 5122455 +RMD160 3723488dab8d164702a7d55c9c72eeaec07dd50c net-snmp-5.4.1.tar.gz 5122455 +SHA256 0ea976722c993c87dede8eb6348e6feb059e3851bbef2de824bf18ac97cdb565 net-snmp-5.4.1.tar.gz 5122455 diff --git a/net-analyzer/net-snmp/files/net-snmp-5.4.1-clientaddr-fix.patch b/net-analyzer/net-snmp/files/net-snmp-5.4.1-clientaddr-fix.patch index 116e524f0c85..e80922144be6 100644 --- a/net-analyzer/net-snmp/files/net-snmp-5.4.1-clientaddr-fix.patch +++ b/net-analyzer/net-snmp/files/net-snmp-5.4.1-clientaddr-fix.patch @@ -1,4 +1,4 @@ -Fix clientaddr functionality. +Fix clientaddr functionality. Includes further memory leak and newline fixes. Previously, the clientaddr option in snmp.conf was parsed, but the actual clientaddr was used to bind(), yet sendmsg() was still called with 0.0.0.0. @@ -13,22 +13,30 @@ Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> Status: Merged in upstream r16654 Tracking-URL: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=1775124&group_id=12694 -diff -NuwbBar --exclude docs --exclude '*.o' --exclude 'config.*' --exclude perl --exclude '*~' net-snmp-5.4.old/snmplib/snmpUDPDomain.c net-snmp-5.4/snmplib/snmpUDPDomain.c ---- net-snmp-5.4.old/snmplib/snmpUDPDomain.c 2006-09-19 16:42:17.000000000 -0700 -+++ net-snmp-5.4/snmplib/snmpUDPDomain.c 2007-08-15 19:17:27.000000000 -0700 -@@ -100,12 +100,15 @@ netsnmp_udp_fmtaddr(netsnmp_transport *t - struct sockaddr_in *to = NULL; +Further fixes: +Revision 16681 + add missing newline in debug msg +Revision 16704 + CHANGES: snmplib: BUG: Coverity #183: fix memory leak if IP_PKTINFO fails +Revision 16716 + CHANGES: snmplib: Do not leak memory whenever an udp address is formatted. + +Fixes bug: bugs.gentoo.org/180266 + +diff -Naur net-snmp-5.4.1.orig/snmplib/snmpUDPDomain.c net-snmp-5.4.1/snmplib/snmpUDPDomain.c +--- net-snmp-5.4.1.orig/snmplib/snmpUDPDomain.c 2007-06-11 02:15:24.000000000 +0400 ++++ net-snmp-5.4.1/snmplib/snmpUDPDomain.c 2007-12-27 18:15:56.000000000 +0300 +@@ -104,11 +104,13 @@ char tmp[64]; to = (struct sockaddr_in *) &(addr_pair->remote_addr); -+ /* Using strdup on the output of inet_ntoa is important! */ if (to == NULL) { - return strdup("UDP: unknown"); + sprintf(tmp, "UDP: [%s]->unknown", -+ strdup(inet_ntoa(addr_pair->local_addr))); ++ inet_ntoa(addr_pair->local_addr)); + } else { -+ sprintf(tmp, "UDP: [%s]->[%s]:%hu", -+ strdup(inet_ntoa(addr_pair->local_addr)), -+ strdup(inet_ntoa(to->sin_addr)), ntohs(to->sin_port)); ++ sprintf(tmp, "UDP: [%s]->", inet_ntoa(addr_pair->local_addr)); ++ sprintf(tmp + strlen(tmp), "[%s]:%hd", ++ inet_ntoa(to->sin_addr), ntohs(to->sin_port)); } - - sprintf(tmp, "UDP: [%s]:%hu", @@ -36,28 +44,52 @@ diff -NuwbBar --exclude docs --exclude '*.o' --exclude 'config.*' --exclude perl return strdup(tmp); } } -@@ -670,11 +673,23 @@ netsnmp_udp_transport(struct sockaddr_in - NETSNMP_DS_LIB_CLIENT_ADDR); +@@ -642,6 +644,7 @@ + if (setsockopt(t->sock, SOL_IP, IP_PKTINFO, &sockopt, sizeof sockopt) == -1) { + DEBUGMSGTL(("netsnmp_udp", "couldn't set IP_PKTINFO: %s\n", + strerror(errno))); ++ netsnmp_transport_free(t); + return NULL; + } + DEBUGMSGTL(("netsnmp_udp", "set IP_PKTINFO\n")); +@@ -667,10 +670,24 @@ if (client_socket) { struct sockaddr_in client_addr; -+ int ret; netsnmp_sockaddr_in2(&client_addr, client_socket, NULL); + addr_pair.local_addr = client_addr.sin_addr; client_addr.sin_port = 0; - bind(t->sock, (struct sockaddr *)&client_addr, -+ ret = bind(t->sock, (struct sockaddr *)&client_addr, ++ rc = bind(t->sock, (struct sockaddr *)&client_addr, sizeof(struct sockaddr)); -+ if(ret) ++ if ( rc != 0 ) { + DEBUGMSGTL(("netsnmp_udp", "failed to bind for clientaddr: %d %s\n", -+ errno,strerror(errno))); -+ /* TODO: should we exit here? */ ++ errno, strerror(errno))); ++ netsnmp_udp_close(t); ++ netsnmp_transport_free(t); ++ return NULL; ++ } } + -+ str = netsnmp_udp_fmtaddr(NULL, (void *)&addr_pair, -+ sizeof(netsnmp_udp_addr_pair)); ++ str = netsnmp_udp_fmtaddr(NULL, (void *)&addr_pair, ++ sizeof(netsnmp_udp_addr_pair)); + DEBUGMSGTL(("netsnmp_udp", "client open %s\n", str)); + free(str); + /* * Save the (remote) address in the * transport-specific data pointer for later use by netsnmp_udp_send. +@@ -839,12 +856,12 @@ + if (host == NULL) { + DEBUGMSGTL(("netsnmp_sockaddr_in", + "servname not numeric, " +- "check if it really is a destination)")); ++ "check if it really is a destination)\n")); + host = port; + port = NULL; + } else { + DEBUGMSGTL(("netsnmp_sockaddr_in", +- "servname not numeric")); ++ "servname not numeric\n")); + free(peername); + return 0; + } diff --git a/net-analyzer/net-snmp/files/net-snmp-5.4.1-suppresssuppress-annoying.patch b/net-analyzer/net-snmp/files/net-snmp-5.4.1-suppresssuppress-annoying.patch new file mode 100644 index 000000000000..f08d8f712694 --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.4.1-suppresssuppress-annoying.patch @@ -0,0 +1,17 @@ +NEWS: agent: suppress annoying "registration != duplicate" warning for root oids +(otherwise, you'll get this message on almost every startup) + +http://net-snmp.svn.sourceforge.net/viewvc/net-snmp?view=rev&revision=16669 + +--- branches/V5-4-patches/net-snmp/agent/agent_registry.c 2007/08/20 08:06:42 16668 ++++ branches/V5-4-patches/net-snmp/agent/agent_registry.c 2007/08/22 21:56:23 16669 +@@ -532,7 +532,8 @@ + + if (next && (next->namelen == new_sub->namelen) && + (next->priority == new_sub->priority)) { +- netsnmp_assert(!"registration != duplicate"); /* always false */ ++ if (new_sub->namelen != 1) /* ignore root OID dups */ ++ netsnmp_assert(!"registration != duplicate"); /* always false */ + return MIB_DUPLICATE_REGISTRATION; + } + diff --git a/net-analyzer/net-snmp/net-snmp-5.4.1-r2.ebuild b/net-analyzer/net-snmp/net-snmp-5.4.1-r2.ebuild new file mode 100644 index 000000000000..66043d919d38 --- /dev/null +++ b/net-analyzer/net-snmp/net-snmp-5.4.1-r2.ebuild @@ -0,0 +1,186 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/net-snmp-5.4.1-r2.ebuild,v 1.1 2007/12/27 17:15:32 pva Exp $ + +inherit fixheadtails flag-o-matic perl-module python + +DESCRIPTION="Software for generating and retrieving SNMP data" +HOMEPAGE="http://net-snmp.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" + +LICENSE="as-is BSD" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="diskio doc elf ipv6 lm_sensors mfd-rewrites minimal perl python rpm selinux smux ssl tcpd X sendmail" + +DEPEND="ssl? ( >=dev-libs/openssl-0.9.6d ) + tcpd? ( >=sys-apps/tcp-wrappers-7.6 ) + rpm? ( + app-arch/rpm + dev-libs/popt + app-arch/bzip2 + >=sys-libs/zlib-1.1.4 + ) + elf? ( dev-libs/elfutils ) + lm_sensors? ( sys-apps/lm_sensors ) + python? ( dev-python/setuptools )" + +RDEPEND="${DEPEND} + perl? ( + X? ( dev-perl/perl-tk ) + !minimal? ( dev-perl/TermReadKey ) + ) + selinux? ( sec-policy/selinux-snmpd )" + +DEPEND="${DEPEND} + >=sys-apps/sed-4 + doc? ( app-doc/doxygen )" + +src_unpack() { + unpack ${A} + cd "${S}" + + # fix access violation in make check + sed -i -e 's/\(snmpd.*\)-Lf/\1-l/' testing/eval_tools.sh || \ + die "sed eval_tools.sh failed" + # fix path in fixproc + sed -i -e 's|\(database_file =.*\)/local\(.*\)$|\1\2|' local/fixproc || \ + die "sed fixproc failed" + + if use python ; then + python_version + PYTHON_MODNAME="netsnmp" + PYTHON_DIR=/usr/$(get_libdir)/python${PYVER}/site-packages + sed -i -e "s:\(install --basedir=\$\$dir\):\1 --root='${D}':" Makefile.in || die "sed python failed" + fi + + epatch "${FILESDIR}"/${P}-clientaddr-fix.patch + epatch "${FILESDIR}"/${P}-suppresssuppress-annoying.patch + + ht_fix_all +} + +src_compile() { + local mibs + + strip-flags + + # filter for bug #145960 + # as it seems that the option is not enough + filter-ldflags -Wl,--as-needed + + mibs="host ucd-snmp/dlmod" + use smux && mibs="${mibs} smux" + use sendmail && mibs="${mibs} mibII/mta_sendmail" + use lm_sensors && mibs="${mibs} ucd-snmp/lmSensors" + use diskio && mibs="${mibs} ucd-snmp/diskio" + + econf \ + --with-install-prefix="${D}" \ + --with-sys-location="Unknown" \ + --with-sys-contact="root@Unknown" \ + --with-default-snmp-version="3" \ + --with-mib-modules="${mibs}" \ + --with-logfile="/var/log/net-snmpd.log" \ + --with-persistent-directory="/var/lib/net-snmp" \ + --enable-ucd-snmp-compatibility \ + --enable-shared \ + --enable-as-needed \ + $(use_enable mfd-rewrites) \ + $(use_enable perl embedded-perl) \ + $(use_enable ipv6) \ + $(use_enable !ssl internal-md5) \ + $(use_with ssl openssl) \ + $(use_with tcpd libwrap) \ + $(use_with rpm) \ + $(use_with rpm bzip2) \ + $(use_with rpm zlib) \ + $(use_with elf) \ + $(use_with python python-modules) \ + || die "econf failed" + + emake -j1 || die "emake failed" + + if use perl ; then + emake perlmodules || die "compile perl modules problem" + fi + + if use python ; then + emake pythonmodules || die "compile python modules problem" + fi + + if use doc ; then + einfo "Building HTML Documentation" + make docsdox || die "failed to build docs" + fi +} + +src_test() { + cd testing + if ! make test ; then + echo + einfo "Don't be alarmed if a few tests FAIL." + einfo "This could happen for several reasons:" + einfo " - You don't already have a working configuration." + einfo " - Your ethernet interface isn't properly configured." + echo + fi +} + +src_install () { + + make DESTDIR="${D}" install || die "make install failed" + + if use perl ; then + make DESTDIR="${D}" perlinstall || die "make perlinstall failed" + fixlocalpod + + use X || rm -f "${D}/usr/bin/tkmib" + else + rm -f "${D}/usr/bin/mib2c" "${D}/usr/bin/tkmib" "${D}/usr/bin/snmpcheck" + fi + + if use python ; then + mkdir -p "${D}/${PYTHON_DIR}" || die "Couldn't make $PYTHON_DIR" + make pythoninstall || die "make pythoninstall failed" + fi + + dodoc AGENT.txt ChangeLog FAQ INSTALL NEWS PORTING README* TODO + newdoc EXAMPLE.conf.def EXAMPLE.conf + + use doc && dohtml docs/html/* + + keepdir /etc/snmp /var/lib/net-snmp + + newinitd "${FILESDIR}"/snmpd.rc7 snmpd + newconfd "${FILESDIR}"/snmpd.conf snmpd + + newinitd "${FILESDIR}"/snmptrapd.rc7 snmptrapd + newconfd "${FILESDIR}"/snmptrapd.conf snmptrapd + + # Remove everything, keeping only the snmpd, snmptrapd, MIBs, libs, and includes. + if use minimal; then + elog "USE=minimal is set. Cleaning up excess cruft for a embedded/minimal/server only install." + rm -rf + "${D}"/usr/bin/{encode_keychange,snmp{get,getnext,set,usm,walk,bulkwalk,table,trap,bulkget,translate,status,delta,test,df,vacm,netstat,inform,snmpcheck}} + rm -rf "${D}"/usr/share/snmp/snmpconf-data "${D}"/usr/share/snmp/*.conf + rm -rf "${D}"/usr/bin/{fixproc,traptoemail} "${D}"/usr/bin/snmpc{heck,onf} + find "${D}" -name '*.pl' -exec rm -f '{}' \; + use ipv6 || rm -rf "${D}"/usr/share/snmp/mibs/IPV6* + fi + + # bug 113788, install example config + insinto /etc/snmp + newins "${S}"/EXAMPLE.conf snmpd.conf.example +} + +pkg_postrm() { + if use python ; then + python_mod_cleanup + fi +} + +pkg_postinst() { + elog "An example configuration file has been installed in" + elog "/etc/snmp/snmpd.conf.example." +} |