summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Volkov <pva@gentoo.org>2007-12-27 17:15:33 +0000
committerPeter Volkov <pva@gentoo.org>2007-12-27 17:15:33 +0000
commit98caf0a1edfcbc1bf041b50c828a3cdec26945a4 (patch)
treef333c840cc5824c7d008428e131eb8b5ee9e1d8e
parentAdded dev-tcltk/Tk_Theme for removal. (diff)
downloadhistorical-98caf0a1edfcbc1bf041b50c828a3cdec26945a4.tar.gz
historical-98caf0a1edfcbc1bf041b50c828a3cdec26945a4.tar.bz2
historical-98caf0a1edfcbc1bf041b50c828a3cdec26945a4.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.
Package-Manager: portage-2.1.3.19
-rw-r--r--net-analyzer/net-snmp/ChangeLog11
-rw-r--r--net-analyzer/net-snmp/Manifest27
-rw-r--r--net-analyzer/net-snmp/files/digest-net-snmp-5.4.1-r23
-rw-r--r--net-analyzer/net-snmp/files/net-snmp-5.4.1-clientaddr-fix.patch72
-rw-r--r--net-analyzer/net-snmp/files/net-snmp-5.4.1-suppresssuppress-annoying.patch17
-rw-r--r--net-analyzer/net-snmp/net-snmp-5.4.1-r2.ebuild186
6 files changed, 287 insertions, 29 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/Manifest b/net-analyzer/net-snmp/Manifest
index 87fc53771fc2..d1cf0b87b6fe 100644
--- a/net-analyzer/net-snmp/Manifest
+++ b/net-analyzer/net-snmp/Manifest
@@ -30,10 +30,14 @@ AUX net-snmp-5.4-makefile.patch 597 RMD160 90f8e6db0a05fd21c06e98b65b4bbd377f931
MD5 d61d49e044489f4b4549cda0b7cbc336 files/net-snmp-5.4-makefile.patch 597
RMD160 90f8e6db0a05fd21c06e98b65b4bbd377f931fe9 files/net-snmp-5.4-makefile.patch 597
SHA256 fd8c6ceda9c5d99cd92f81a7977d2134960ee14fac3ab9f1f8c6d03c6a69edb1 files/net-snmp-5.4-makefile.patch 597
-AUX net-snmp-5.4.1-clientaddr-fix.patch 2942 RMD160 02893663d464cce39f6b54c3e27776d27fe5fe67 SHA1 fee0d795797f73de463aceaad13ebc24311763b9 SHA256 355b5661d1ecc066a8094969269b8af35e63e406a32547d6b0f8c3c57b1a4685
-MD5 68ccb8d180ff38847ed5e8d2561cbaee files/net-snmp-5.4.1-clientaddr-fix.patch 2942
-RMD160 02893663d464cce39f6b54c3e27776d27fe5fe67 files/net-snmp-5.4.1-clientaddr-fix.patch 2942
-SHA256 355b5661d1ecc066a8094969269b8af35e63e406a32547d6b0f8c3c57b1a4685 files/net-snmp-5.4.1-clientaddr-fix.patch 2942
+AUX net-snmp-5.4.1-clientaddr-fix.patch 4013 RMD160 52c45d7dd34b5aadcfd7ef48c445d47b5491936d SHA1 714fc3fccc65516ae2a6d836ce181edfd4dc83c3 SHA256 15a8f05e47eb337d8963ed2b1fd81ecb00fe9b631d3281507bdc1b17c5d542cb
+MD5 a2d2ee125af2704131671fa9bae4202f files/net-snmp-5.4.1-clientaddr-fix.patch 4013
+RMD160 52c45d7dd34b5aadcfd7ef48c445d47b5491936d files/net-snmp-5.4.1-clientaddr-fix.patch 4013
+SHA256 15a8f05e47eb337d8963ed2b1fd81ecb00fe9b631d3281507bdc1b17c5d542cb files/net-snmp-5.4.1-clientaddr-fix.patch 4013
+AUX net-snmp-5.4.1-suppresssuppress-annoying.patch 800 RMD160 aa23a30241ae64aeed6a08a630326fd7c2e0f9fe SHA1 2b99c56d1f659f324c5676d48ab257ea3b55467f SHA256 f5249b782079be96256ab6e7a0d398c04dfbcabffa7f4c716fe1abd39897aabe
+MD5 c7a81ab1db56208f1741b55a603cd9a0 files/net-snmp-5.4.1-suppresssuppress-annoying.patch 800
+RMD160 aa23a30241ae64aeed6a08a630326fd7c2e0f9fe files/net-snmp-5.4.1-suppresssuppress-annoying.patch 800
+SHA256 f5249b782079be96256ab6e7a0d398c04dfbcabffa7f4c716fe1abd39897aabe files/net-snmp-5.4.1-suppresssuppress-annoying.patch 800
AUX net-snmp-lm_sensors.patch 13686 RMD160 b2e67c6f5a5347442fbaa97c9ce209f1d9bed194 SHA1 3e795339fc93306a4d662feeaa16faca2509a058 SHA256 51dc2363a687d9f4e65b0a59e767b33129d07623a0b4da07b685e406d2576b86
MD5 25d92c9a7adcbb80240a914a8f6bbfe5 files/net-snmp-lm_sensors.patch 13686
RMD160 b2e67c6f5a5347442fbaa97c9ce209f1d9bed194 files/net-snmp-lm_sensors.patch 13686
@@ -100,6 +104,10 @@ EBUILD net-snmp-5.4.1-r1.ebuild 5671 RMD160 f80be0a51951407ea401887739415e4bbde6
MD5 3a7d3dd24eb2b1fd67ac39da6d17149b net-snmp-5.4.1-r1.ebuild 5671
RMD160 f80be0a51951407ea401887739415e4bbde6ab42 net-snmp-5.4.1-r1.ebuild 5671
SHA256 1baa77f1f39a2015cc5c66487cceef4d87719b3ad142993b094469d7ea6067e3 net-snmp-5.4.1-r1.ebuild 5671
+EBUILD net-snmp-5.4.1-r2.ebuild 5169 RMD160 7a50bb113a9e575e199c4535f1f4d8ad4f3d5496 SHA1 af5afa610acdbccd3632175d9ce4526e692b35de SHA256 0cd1e6f6a9e1880e2c0eba731269241199bb90c03ee19638da43561a02fb7eaf
+MD5 4707202a75c151e5dcf7109967d17253 net-snmp-5.4.1-r2.ebuild 5169
+RMD160 7a50bb113a9e575e199c4535f1f4d8ad4f3d5496 net-snmp-5.4.1-r2.ebuild 5169
+SHA256 0cd1e6f6a9e1880e2c0eba731269241199bb90c03ee19638da43561a02fb7eaf net-snmp-5.4.1-r2.ebuild 5169
EBUILD net-snmp-5.4.1.ebuild 5051 RMD160 a113ba6a87b6c7094aba585d03243fece4c26eba SHA1 46501f28f9fc0fea166b0a5446b2bd8c055fe4a5 SHA256 3609f85a23da0f2c1ecb1543c8e6a4f920b8d420c0c7aefcf40e84dee54bee8d
MD5 37f33954140d72610c3123bde5c1b0e7 net-snmp-5.4.1.ebuild 5051
RMD160 a113ba6a87b6c7094aba585d03243fece4c26eba net-snmp-5.4.1.ebuild 5051
@@ -108,10 +116,10 @@ EBUILD net-snmp-5.4.ebuild 4980 RMD160 0644c9f896aad2319b6118a0197b1e5e1bf9dbae
MD5 b364b3ea366405299dd623556f0cac96 net-snmp-5.4.ebuild 4980
RMD160 0644c9f896aad2319b6118a0197b1e5e1bf9dbae net-snmp-5.4.ebuild 4980
SHA256 ca149d10943ae6cb71d0485fa939bb6d6ed0636f084948b03a91c0266a67b333 net-snmp-5.4.ebuild 4980
-MISC ChangeLog 26087 RMD160 2a76cc4161dd6b9d8c3e118c3f01dc648745be95 SHA1 cdd9b4809ccb96db75d51c55c41a7cbad52656cf SHA256 84c8ee783780d5735f9a5dd37a8ffe56255fe55bf902fdf46b08fe0d28d902ed
-MD5 871022ce023ba2b3127a81aea5d19ad7 ChangeLog 26087
-RMD160 2a76cc4161dd6b9d8c3e118c3f01dc648745be95 ChangeLog 26087
-SHA256 84c8ee783780d5735f9a5dd37a8ffe56255fe55bf902fdf46b08fe0d28d902ed ChangeLog 26087
+MISC ChangeLog 26491 RMD160 ad6f6a614d82f8ff8898598dc30369fa6318c452 SHA1 af7ce8a5d165b22c7f346df0522e0ea7b72006d3 SHA256 b8ab2fe0dfdcdcc73c985eebac34d221fcf0c73f62c90234c19f8afd4615880b
+MD5 c646683507cfe31808ea535361f7d32b ChangeLog 26491
+RMD160 ad6f6a614d82f8ff8898598dc30369fa6318c452 ChangeLog 26491
+SHA256 b8ab2fe0dfdcdcc73c985eebac34d221fcf0c73f62c90234c19f8afd4615880b ChangeLog 26491
MISC metadata.xml 160 RMD160 2738573ec519cbef4b293bc132f7dd9d02291137 SHA1 29b8b234e0f3a475b50bd4df1ef8b4e5749823ce SHA256 39e232fc7ec88ca0b077cb3950cb39d15cd990842b88d5bfe14f02f34d72f37b
MD5 637389da071d8ee0c0292695525bc29f metadata.xml 160
RMD160 2738573ec519cbef4b293bc132f7dd9d02291137 metadata.xml 160
@@ -143,3 +151,6 @@ SHA256 2f2084a65a62043ef1cb434c7ed0717ed22310fa0bd3225946c19b7fb6864ecb files/di
MD5 2e34b0d7a577176cbcf6ef8d902718fb files/digest-net-snmp-5.4.1-r1 247
RMD160 eea7a4c51416de3c43bcf3c2404be5affd3f6118 files/digest-net-snmp-5.4.1-r1 247
SHA256 2f2084a65a62043ef1cb434c7ed0717ed22310fa0bd3225946c19b7fb6864ecb files/digest-net-snmp-5.4.1-r1 247
+MD5 2e34b0d7a577176cbcf6ef8d902718fb files/digest-net-snmp-5.4.1-r2 247
+RMD160 eea7a4c51416de3c43bcf3c2404be5affd3f6118 files/digest-net-snmp-5.4.1-r2 247
+SHA256 2f2084a65a62043ef1cb434c7ed0717ed22310fa0bd3225946c19b7fb6864ecb files/digest-net-snmp-5.4.1-r2 247
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."
+}