delete old ebuilds

git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@2685 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
geos_one
2010-11-07 06:47:25 +00:00
parent de3fbb764b
commit 376e917bd3
157 changed files with 14 additions and 10930 deletions

View File

@@ -1,16 +0,0 @@
# ChangeLog for net-analyzer/net-snmp
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
09 May 2010; Mario Fetka <mario.fetka@gmail.com>
-net-snmp-5.4.1.1-r1.ebuild, -net-snmp-5.4.2.1-r1.ebuild,
-net-snmp-5.4.2.1-r2.ebuild, +net-snmp-5.4.2.1-r4.ebuild:
Bump rpm patch
22 Nov 2008; Mario Fetka <mario.fetka@gmail.com>
+files/rpm514-netsnmp-5.4.1.1.patch, +net-snmp-5.4.2.1-r1.ebuild:
Bump
04 Nov 2008; Mario Fetka <mario.fetka@gmail.com> ChangeLog:
add rpm 5 patch

View File

@@ -1,26 +0,0 @@
AUX CVE-2008-6123.patch 867 RMD160 1e8b6521ae0955681493c1ba594eb0344183e147 SHA1 3742c405fab9ac829acc93383bc39ba5b39962e9 SHA256 31a9b72b252582cd84e7f673b670ebbd2153dc719894aa668a48b24d6ba516f6
AUX net-snmp-5.1.2-snmpconf-selinux.patch 286 RMD160 c78fd9d2a563ebafd21aa85a582b989a805eb645 SHA1 159990e855cfeb50ac3657d1b97eda181d4ffb9e SHA256 70b4bdaa243efd5ae5703b3272063314fc56b6e2333f7c650b635ddab141f874
AUX net-snmp-5.4-exec-crash.patch 567 RMD160 fe110ace0ae451a8cf25d18d4133fb0d85dcaf5c SHA1 4a4538958e4c805981e1f0da4d6f1980a03aeab6 SHA256 2c4d3d281380d394d0d349c37839bb89f3d82d3e1c43513e042d24126441741c
AUX net-snmp-5.4-makefile.patch 597 RMD160 90f8e6db0a05fd21c06e98b65b4bbd377f931fe9 SHA1 2ff51b2ab2df2224dd34ca1af16430fbf0b97927 SHA256 fd8c6ceda9c5d99cd92f81a7977d2134960ee14fac3ab9f1f8c6d03c6a69edb1
AUX net-snmp-5.4.1-CVE-2008-2292.patch 6212 RMD160 79b2e05df4623972dbaea2dd92dea4a46975c566 SHA1 7fe5f5e9785deeaa1852de76fcba17cbbf9781dc SHA256 10908598aa445bad84708af3ebba1e6a6d985a8008e0c4be42df556851f6a48d
AUX net-snmp-5.4.1-clientaddr-fix.patch 4013 RMD160 52c45d7dd34b5aadcfd7ef48c445d47b5491936d SHA1 714fc3fccc65516ae2a6d836ce181edfd4dc83c3 SHA256 15a8f05e47eb337d8963ed2b1fd81ecb00fe9b631d3281507bdc1b17c5d542cb
AUX net-snmp-5.4.1-incorrect-hrFSStorageIndex.patch 16053 RMD160 1d33a23b165946f7dd4e97b329c79d27c42ec913 SHA1 c4a107c35cf96b3c52a3156ab9f999b46582b693 SHA256 2d3aad8d76046e11a520d45bc5d3304b1ceff91c6d5a5510dc020aae47506b3d
AUX net-snmp-5.4.1-ipAddressTable-crash-with-double-free.patch 4740 RMD160 305f962976c6afc39b0ee37706f34d05ea768874 SHA1 93b806c407048cba4f5c63137df1e819c83d0010 SHA256 0872a11f48106f1a2a9c4a8a894abe31b04ee607bdfd44b8207c8e659213ef31
AUX net-snmp-5.4.1-perl-asneeded.patch 1219 RMD160 caced600c35165603069e62a17a664d7a0180586 SHA1 89bedb2424d65176a9bfba8c9b318b1d50b5b3ed SHA256 42640b545363cd5c6c7eef6b17b10c1d256e189ceb7b7c874baa4041de24e151
AUX net-snmp-5.4.1-process-count-race.patch 1489 RMD160 221f218270b83afec95d1efd260109b8baf05626 SHA1 3986f4789c145dd7182bf5f7d94a1cda0504ce5c SHA256 74a6e001de7a855079be988dd0cb23190095082e1a9adaefb9a9cac677ffa116
AUX net-snmp-5.4.1-sensors3-version_detect.patch 1391 RMD160 eba5c1cba2fc5d0484143eb4b41f656f5f72bee4 SHA1 8c8ebcc9e4725e91cc7b07cdd45cbcf6e2ed806e SHA256 e18f7bd358c4f587793f9e9250489200d2708b50529dfe222f04b71617fa1e59
AUX net-snmp-5.4.1-sensors3.patch 48401 RMD160 9899c587eb252cf9edac758133a420ef0307c315 SHA1 cd5adc2fab5c1d58c8a318d34aa3fcd4fd25c455 SHA256 e74e06a5f23350a2851fdc9f419335767d898ec66dd809e1c0413e39034d6f53
AUX net-snmp-5.4.1-suppresssuppress-annoying.patch 800 RMD160 aa23a30241ae64aeed6a08a630326fd7c2e0f9fe SHA1 2b99c56d1f659f324c5676d48ab257ea3b55467f SHA256 f5249b782079be96256ab6e7a0d398c04dfbcabffa7f4c716fe1abd39897aabe
AUX net-snmp-5.4.1.1-rpm5-1.patch 2258 RMD160 e29716d03c86874579c1fb2f3edafd5867991286 SHA1 3a403ef15bb2edf151531b5fd291df6937ef216e SHA256 ad958fcf18565930e428027e6ea60546865947b149255b2e166e9fe2a8726ee5
AUX net-snmp-lm_sensors.patch 13686 RMD160 b2e67c6f5a5347442fbaa97c9ce209f1d9bed194 SHA1 3e795339fc93306a4d662feeaa16faca2509a058 SHA256 51dc2363a687d9f4e65b0a59e767b33129d07623a0b4da07b685e406d2576b86
AUX rpm514-netsnmp-5.4.1.1.patch 11813 RMD160 de2ed34c72280d2da308a0f1e0b293d51f2c391c SHA1 5856bc7531c40e7b9be267b5cd117d6ddf7dc043 SHA256 801039ba6a484fe83c7e1940e4227fccafe4c7cf1962f9fcda01e70869abaa28
AUX snmpd.conf 598 RMD160 c72a20fe6d4682ceea533587762782d62906b630 SHA1 51ebdca93c68ca04b7f402fad4f504422ec2c6cf SHA256 1f4f07b831c3227588fd546423137ed5c60a602fbee13b0d66edd801e4e7d598
AUX snmpd.init 1054 RMD160 6cc814d19524e1899b4bb9539ee9752304451bc9 SHA1 ed2b1a4bd7da84ca6294c0df66cace2e7c0ffe72 SHA256 824ae327db4d76fe4cdc882f06ac989e510ee1ee96c90137ab84bc18446ba8b6
AUX snmpd.rc7 706 RMD160 137d85e5f2b7cae62e214141aabcec495777007e SHA1 8d94d3bb2d3b43e20604030dc585c735685cf99b SHA256 93337ebeac92ec0073c896db0a4384beebf84ee17365bdc2594285fd33ac7dfe
AUX snmptrapd.conf 635 RMD160 aba7b7196835bd359174156a527e13188f76e248 SHA1 0d296caa01c789455c3cd4c67cd81aca5547681d SHA256 902d73cb44446df060bf20e0c8ef0f8815d5b846f96d93894913d3309a3841b3
AUX snmptrapd.init 624 RMD160 799faf488a62bc219d3765ed6d6283ca7764ad1c SHA1 1fdef5a0a29f181c2df31b9d7adc4d4ebb8b018c SHA256 0e6dae4ca0213be9f9311c8dacdf36e7fea05150db48d15660506d53abda5a39
AUX snmptrapd.rc7 557 RMD160 e67117fbcb0a6f8668cb1abbc8fcfcb548ebfdb5 SHA1 dcaac6c0f9e086e49f653f100e0c3f9a7f65db1d SHA256 3594345cdf3c9a5a04073ec11a54e4a19881b27288cdbf22874cca5d0a0f624c
DIST net-snmp-5.4.2.1.tar.gz 5185390 RMD160 2148c42d486ed88f9cfc3ca1d50c68abcd7e3d63 SHA1 4f2df9ea62344fe840f493d0e08abe5de3697862 SHA256 11a8baf167f7bfff60d2590e050991400a3a082923dbcdbf85e0e0ce46eb247c
EBUILD net-snmp-5.4.2.1-r4.ebuild 5843 RMD160 54ca0282db67d877bda09bfab8396e4bddb24bc9 SHA1 18cb85f3b53b6ebc20abf94ad57f5acb2e844f4a SHA256 c24133c4ae84ac0705680f7d853abed3e6608e4073eb5d2e4e5045ca0620e81f
MISC ChangeLog 519 RMD160 91ab2308122a2cefaf60350866c60fdd186d5ec5 SHA1 1b81f13fc245938bef551e25bdc9d7245a1ca3be SHA256 f84e6afeaacf242683c69acb3e26f3f91818459591e61e1e048da12bd6733938
MISC metadata.xml 674 RMD160 102cd7df943ef25f0f462f2520fa77ceac3b5680 SHA1 90b51daab27e161a48feed336a348a8ecf0865c2 SHA256 233feade72f1b013bb5b0739478ab7200727db25a1d06977d0d122862565de24

View File

@@ -1,19 +0,0 @@
diff -Naur snmplib.orig/snmpUDPDomain.c snmplib/snmpUDPDomain.c
--- snmplib.orig/snmpUDPDomain.c 2007-10-11 22:46:30.000000000 +0200
+++ snmplib/snmpUDPDomain.c 2009-07-10 23:41:37.000000000 +0200
@@ -104,12 +110,12 @@
char tmp[64];
to = (struct sockaddr_in *) &(addr_pair->remote_addr);
if (to == NULL) {
- sprintf(tmp, "UDP: [%s]->unknown",
+ sprintf(tmp, "UDP: unknown->[%s]",
inet_ntoa(addr_pair->local_addr));
} else {
- sprintf(tmp, "UDP: [%s]->", inet_ntoa(addr_pair->local_addr));
- sprintf(tmp + strlen(tmp), "[%s]:%hd",
+ sprintf(tmp, "UDP: [%s]:%hu->",
inet_ntoa(to->sin_addr), ntohs(to->sin_port));
+ sprintf(tmp + strlen(tmp), "[%s]", inet_ntoa(addr_pair->local_addr));
}
return strdup(tmp);
}

View File

@@ -1,12 +0,0 @@
https://bugzilla.redhat.com/show_bug.cgi?id=248329
--- net-snmp-5.1.2/local/snmpconf.orig 2004-04-20 16:20:51.000000000 +0200
+++ net-snmp-5.1.2/local/snmpconf 2007-07-09 15:34:48.000000000 +0200
@@ -585,6 +585,7 @@
}
}
close(O);
+ system("restorecon $outputf");
}
}

View File

@@ -1,14 +0,0 @@
https://bugzilla.redhat.com/show_bug.cgi?id=243536
--- net-snmp-5.4/agent/mibgroup/agent/extend.c.orig 2006-10-18 21:07:35.000000000 +0200
+++ net-snmp-5.4/agent/mibgroup/agent/extend.c 2007-06-27 14:30:08.000000000 +0200
@@ -448,6 +448,9 @@
extension->command = strdup( exec_command );
if (cptr)
extension->args = strdup( cptr );
+ } else {
+ snmp_log(LOG_ERR, "Duplicate MIBOID '%s' detected in exec statement, only the first one will be used.\n", exec_name);
+ return;
}
#ifndef USING_UCD_SNMP_EXTENSIBLE_MODULE

View File

@@ -1,20 +0,0 @@
diff -ru net-snmp-5.4~/agent/mibgroup/Makefile.in net-snmp-5.4/agent/mibgroup/Makefile.in
--- net-snmp-5.4~/agent/mibgroup/Makefile.in 2006-11-26 16:43:18.000000000 +0100
+++ net-snmp-5.4/agent/mibgroup/Makefile.in 2006-11-26 16:44:49.000000000 +0100
@@ -22,9 +22,13 @@
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
-OBJS = @mib_module_list_o@
-LOBJS = @mib_module_list_lo@
-SRCS = @mib_module_list_c@
+@mib_module_list_o@
+@mib_module_list_lo@
+@mib_module_list_c@
+
+OBJS = $(mib_module_list_o)
+LOBJS = $(mib_module_list_lo)
+SRCS = $(mib_module_list_c)
all: standardall $(LOBJS)

View File

@@ -1,192 +0,0 @@
r16770 | dts12 | 2007-12-22 22:22:44 +0300 (Сбт, 22 Дек 2007) | 2 lines
CHANGES: perl: BUG: 1826174: Check for buffer overflow when printing values.
CHANGES: python: BUG: 1826174: Check for buffer overflow when printing values.
Addresses CVE-2008-2292
--- perl/SNMP/SNMP.xs (revision 16769)
+++ perl/SNMP/SNMP.xs (revision 16770)
@@ -470,14 +470,16 @@
if (flag == USE_ENUMS) {
for(ep = tp->enums; ep; ep = ep->next) {
if (ep->value == *var->val.integer) {
- strcpy(buf, ep->label);
+ strncpy(buf, ep->label, buf_len);
+ buf[buf_len-1] = '\0';
len = strlen(buf);
break;
}
}
}
if (!len) {
- sprintf(buf,"%ld", *var->val.integer);
+ snprintf(buf, buf_len, "%ld", *var->val.integer);
+ buf[buf_len-1] = '\0';
len = strlen(buf);
}
break;
@@ -486,21 +488,25 @@
case ASN_COUNTER:
case ASN_TIMETICKS:
case ASN_UINTEGER:
- sprintf(buf,"%lu", (unsigned long) *var->val.integer);
+ snprintf(buf, buf_len, "%lu", (unsigned long) *var->val.integer);
+ buf[buf_len-1] = '\0';
len = strlen(buf);
break;
case ASN_OCTET_STR:
case ASN_OPAQUE:
- memcpy(buf, (char*)var->val.string, var->val_len);
len = var->val_len;
+ if ( len > buf_len )
+ len = buf_len;
+ memcpy(buf, (char*)var->val.string, len);
break;
case ASN_IPADDRESS:
- ip = (u_char*)var->val.string;
- sprintf(buf, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
- len = strlen(buf);
- break;
+ ip = (u_char*)var->val.string;
+ snprintf(buf, buf_len, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
+ buf[buf_len-1] = '\0';
+ len = strlen(buf);
+ break;
case ASN_NULL:
break;
@@ -512,14 +518,14 @@
break;
case SNMP_ENDOFMIBVIEW:
- sprintf(buf,"%s", "ENDOFMIBVIEW");
- break;
+ snprintf(buf, buf_len, "%s", "ENDOFMIBVIEW");
+ break;
case SNMP_NOSUCHOBJECT:
- sprintf(buf,"%s", "NOSUCHOBJECT");
- break;
+ snprintf(buf, buf_len, "%s", "NOSUCHOBJECT");
+ break;
case SNMP_NOSUCHINSTANCE:
- sprintf(buf,"%s", "NOSUCHINSTANCE");
- break;
+ snprintf(buf, buf_len, "%s", "NOSUCHINSTANCE");
+ break;
case ASN_COUNTER64:
#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
@@ -538,19 +544,19 @@
#endif
case ASN_BIT_STR:
- snprint_bitstring(buf, sizeof(buf), var, NULL, NULL, NULL);
+ snprint_bitstring(buf, buf_len, var, NULL, NULL, NULL);
len = strlen(buf);
break;
#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
case ASN_OPAQUE_FLOAT:
- if (var->val.floatVal)
- sprintf(buf,"%f", *var->val.floatVal);
- break;
+ if (var->val.floatVal)
+ snprintf(buf, buf_len, "%f", *var->val.floatVal);
+ break;
case ASN_OPAQUE_DOUBLE:
- if (var->val.doubleVal)
- sprintf(buf,"%f", *var->val.doubleVal);
- break;
+ if (var->val.doubleVal)
+ snprintf(buf, buf_len, "%f", *var->val.doubleVal);
+ break;
#endif
case ASN_NSAP:
--- python/netsnmp/client_intf.c (revision 16961)
+++ python/netsnmp/client_intf.c (revision 16962)
@@ -330,14 +330,15 @@
if (flag == USE_ENUMS) {
for(ep = tp->enums; ep; ep = ep->next) {
if (ep->value == *var->val.integer) {
- strcpy(buf, ep->label);
+ strncpy(buf, ep->label, buf_len);
+ buf[buf_len -1] = 0;
len = STRLEN(buf);
break;
}
}
}
if (!len) {
- sprintf(buf,"%ld", *var->val.integer);
+ snprintf(buf,"%ld", buf_len, *var->val.integer);
len = STRLEN(buf);
}
break;
@@ -346,19 +347,21 @@
case ASN_COUNTER:
case ASN_TIMETICKS:
case ASN_UINTEGER:
- sprintf(buf,"%lu", (unsigned long) *var->val.integer);
+ snprintf(buf, buf_len, "%lu", (unsigned long) *var->val.integer);
len = STRLEN(buf);
break;
case ASN_OCTET_STR:
case ASN_OPAQUE:
- memcpy(buf, (char*)var->val.string, var->val_len);
len = var->val_len;
+ if (len > buf_len)
+ len = buf_len;
+ memcpy(buf, (char*)var->val.string, len);
break;
case ASN_IPADDRESS:
ip = (u_char*)var->val.string;
- sprintf(buf, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
+ snprintf(buf, buf_len, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
len = STRLEN(buf);
break;
@@ -372,13 +375,13 @@
break;
case SNMP_ENDOFMIBVIEW:
- sprintf(buf,"%s", "ENDOFMIBVIEW");
+ snprintf(buf, buf_len, "%s", "ENDOFMIBVIEW");
break;
case SNMP_NOSUCHOBJECT:
- sprintf(buf,"%s", "NOSUCHOBJECT");
+ snprintf(buf, buf_len, "%s", "NOSUCHOBJECT");
break;
case SNMP_NOSUCHINSTANCE:
- sprintf(buf,"%s", "NOSUCHINSTANCE");
+ snprintf(buf, buf_len, "%s", "NOSUCHINSTANCE");
break;
case ASN_COUNTER64:
@@ -398,18 +401,18 @@
#endif
case ASN_BIT_STR:
- snprint_bitstring(buf, sizeof(buf), var, NULL, NULL, NULL);
+ snprint_bitstring(buf, buf_len, var, NULL, NULL, NULL);
len = STRLEN(buf);
break;
#ifdef OPAQUE_SPECIAL_TYPES
case ASN_OPAQUE_FLOAT:
if (var->val.floatVal)
- sprintf(buf,"%f", *var->val.floatVal);
+ snprintf(buf, buf_len, "%f", *var->val.floatVal);
break;
case ASN_OPAQUE_DOUBLE:
if (var->val.doubleVal)
- sprintf(buf,"%f", *var->val.doubleVal);
+ snprintf(buf, buf_len, "%f", *var->val.doubleVal);
break;
#endif

View File

@@ -1,95 +0,0 @@
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.
This patch alters:
- netsnmp_udp_fmtaddr: include both sides of addr_pair for debugging.
- netsnmp_udp_transport: Set addr_pair->local_addr in the remote && client_socket path.
- netsnmp_udp_transport: Print a debugging error on failure to bind()
- netsnmp_udp_transport: Print out the full client open addr_pair data.
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
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);
if (to == NULL) {
- return strdup("UDP: unknown");
+ sprintf(tmp, "UDP: [%s]->unknown",
+ inet_ntoa(addr_pair->local_addr));
+ } else {
+ 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",
- inet_ntoa(to->sin_addr), ntohs(to->sin_port));
return strdup(tmp);
}
}
@@ -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;
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,
+ rc = bind(t->sock, (struct sockaddr *)&client_addr,
sizeof(struct sockaddr));
+ if ( rc != 0 ) {
+ DEBUGMSGTL(("netsnmp_udp", "failed to bind for clientaddr: %d %s\n",
+ 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));
+ 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;
}

View File

@@ -1,538 +0,0 @@
r16694 | rstory | 2007-09-14 17:11:59 +0400 (Птн, 14 Сен 2007) | 3 lines
Apple patches
- add/fix disk/partition tables on darwin
Also fixes incorrect hrFSStorageIndex
http://bugs.gentoo.org/show_bug.cgi?id=211660
http://sourceforge.net/tracker/index.php?func=detail&aid=1696044&group_id=12694&atid=312694
--- agent/mibgroup/host/hr_partition.c (revision 16693)
+++ agent/mibgroup/host/hr_partition.c (revision 16694)
@@ -1,8 +1,17 @@
-
/*
* Host Resources MIB - partition device group implementation - hr_partition.c
*
*/
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright (C) 2007 Apple, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
#include <net-snmp/net-snmp-config.h>
#include <fcntl.h>
@@ -35,6 +44,9 @@
static int HRP_savedDiskIndex;
static int HRP_savedPartIndex;
static char HRP_savedName[1024];
+#ifdef NETSNMP_CAN_GET_DISK_LABEL
+static char HRP_savedLabel[1024];
+#endif
static int HRP_DiskIndex;
@@ -135,6 +147,7 @@
(name[HRPART_DISK_NAME_LENGTH] &
((1 << HRDEV_TYPE_SHIFT) - 1));
+ DEBUGMSGTL(("host/hr_partition", "... low index %d\n", LowDiskIndex));
while (HRP_DiskIndex < LowDiskIndex) {
Init_HR_Partition(); /* moves to next disk */
if (HRP_DiskIndex == -1)
@@ -144,6 +157,7 @@
for (;;) {
part_idx = Get_Next_HR_Partition();
+ DEBUGMSGTL(("host/hr_partition", "... part index %d\n", part_idx));
if (part_idx == 0)
break;
newname[HRPART_DISK_NAME_LENGTH] =
@@ -225,8 +239,13 @@
long_return = part_idx;
return (u_char *) & long_return;
case HRPART_LABEL:
+#ifdef NETSNMP_CAN_GET_DISK_LABEL
+ *var_len = strlen(HRP_savedLabel);
+ return (u_char *) HRP_savedLabel;
+#else
*var_len = strlen(HRP_savedName);
return (u_char *) HRP_savedName;
+#endif
case HRPART_ID: /* Use the device number */
sprintf(string, "0x%x", (int) stat_buf.st_rdev);
*var_len = strlen(string);
@@ -259,9 +278,11 @@
static void
Init_HR_Partition(void)
{
+ DEBUGMSGTL(("host/hr_partition", "Init_HR_Partition\n"));
HRP_DiskIndex = Get_Next_HR_Disk();
if (HRP_DiskIndex != -1)
HRP_DiskIndex &= ((1 << HRDEV_TYPE_SHIFT) - 1);
+ DEBUGMSGTL(("host/hr_partition", "... %d\n",HRP_DiskIndex));
HRP_index = -1;
}
@@ -272,6 +293,7 @@
char string[1024];
int fd;
+ DEBUGMSGTL(("host/hr_partition", "Get_Next_HR_Partition %d\n",HRP_DiskIndex));
if (HRP_DiskIndex == -1) {
return 0;
}
@@ -309,4 +331,7 @@
HRP_savedDiskIndex = disk_idx;
HRP_savedPartIndex = part_idx;
(void) Get_Next_HR_Disk_Partition(HRP_savedName, sizeof(HRP_savedName), HRP_index);
+#ifdef NETSNMP_CAN_GET_DISK_LABEL
+ (void) Get_HR_Disk_Label(HRP_savedLabel, sizeof(HRP_savedLabel), HRP_savedName);
+#endif
}
Index: agent/mibgroup/host/hr_filesys.c
===================================================================
--- agent/mibgroup/host/hr_filesys.c (revision 16693)
+++ agent/mibgroup/host/hr_filesys.c (revision 16694)
@@ -2,11 +2,25 @@
* Host Resources MIB - File System device group implementation - hr_filesys.c
*
*/
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright (C) 2007 Apple, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
#include "host_res.h"
#include "hr_filesys.h"
#include "hr_storage.h"
+#include "hr_disk.h"
#include <net-snmp/utilities.h>
#if HAVE_MNTENT_H
@@ -535,7 +549,7 @@
long_return = 2; /* others probably aren't */
return (u_char *) & long_return;
case HRFSYS_STOREIDX:
- long_return = fsys_idx + HRS_TYPE_FIXED_MAX;
+ long_return = fsys_idx + NETSNMP_MEM_TYPE_MAX;
return (u_char *) & long_return;
case HRFSYS_FULLDUMP:
return when_dumped(HRFS_entry->HRFS_name, FULL_DUMP, var_len);
Index: agent/mibgroup/host/hr_disk.c
===================================================================
--- agent/mibgroup/host/hr_disk.c (revision 16693)
+++ agent/mibgroup/host/hr_disk.c (revision 16694)
@@ -2,6 +2,16 @@
* Host Resources MIB - disk device group implementation - hr_disk.c
*
*/
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright (C) 2007 Apple, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
#include <net-snmp/net-snmp-config.h>
#include "host_res.h"
@@ -65,6 +75,15 @@
#include <limits.h>
#endif
+#ifdef darwin
+#include <CoreFoundation/CoreFoundation.h>
+#include <IOKit/IOKitLib.h>
+#include <IOKit/storage/IOBlockStorageDriver.h>
+#include <IOKit/storage/IOMedia.h>
+#include <IOKit/IOBSD.h>
+#include <DiskArbitration/DADisk.h>
+#endif
+
#ifdef linux
/*
* define BLKGETSIZE from <linux/fs.h>:
@@ -79,6 +98,27 @@
#define HRD_MONOTONICALLY_INCREASING
+/*************************************************************
+ * constants for enums for the MIB node
+ * hrDiskStorageAccess (INTEGER / ASN_INTEGER)
+ */
+#define HRDISKSTORAGEACCESS_READWRITE 1
+#define HRDISKSTORAGEACCESS_READONLY 2
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * hrDiskStorageMedia (INTEGER / ASN_INTEGER)
+ */
+#define HRDISKSTORAGEMEDIA_OTHER 1
+#define HRDISKSTORAGEMEDIA_UNKNOWN 2
+#define HRDISKSTORAGEMEDIA_HARDDISK 3
+#define HRDISKSTORAGEMEDIA_FLOPPYDISK 4
+#define HRDISKSTORAGEMEDIA_OPTICALDISKROM 5
+#define HRDISKSTORAGEMEDIA_OPTICALDISKWORM 6
+#define HRDISKSTORAGEMEDIA_OPTICALDISKRW 7
+#define HRDISKSTORAGEMEDIA_RAMDISK 8
+
/*********************
*
* Kernel & interface information,
@@ -132,6 +172,19 @@
static struct disklabel HRD_info;
#endif
+#ifdef darwin
+static int64_t HRD_cap;
+static int HRD_access;
+static int HRD_type;
+static int HRD_removeble;
+static char HRD_model[40];
+static int HRD_saved_access;
+static int HRD_saved_type;
+static int HRD_saved_removeble;
+static int _get_type_from_protocol( const char *prot );
+static int _get_type_value( const char *str_type );
+#endif
+
static void parse_disk_config(const char *, char *);
static void free_disk_config(void);
@@ -185,6 +238,8 @@
"/dev/rdsk/c%dt%dd0s0", 0, 7);
Add_HR_Disk_entry("/dev/rdsk/c%dd%ds%d", 0, 7, 0, 15,
"/dev/rdsk/c%dd%ds0", 0, 7);
+#elif defined(darwin)
+ Add_HR_Disk_entry("/dev/disk%ds%d", -1, -1, 0, 32, "/dev/disk%d", 1, 32);
#elif defined(freebsd4) || defined(freebsd5)
Add_HR_Disk_entry("/dev/ad%ds%d%c", 0, 1, 1, 4, "/dev/ad%ds%d", 'a', 'h');
Add_HR_Disk_entry("/dev/da%ds%d%c", 0, 1, 1, 4, "/dev/da%ds%d", 'a', 'h');
@@ -484,6 +539,7 @@
Init_HR_Disk();
for (;;) {
disk_idx = Get_Next_HR_Disk();
+ DEBUGMSGTL(("host/hr_disk", "... index %d\n", disk_idx));
if (disk_idx == -1)
break;
newname[HRDISK_ENTRY_NAME_LENGTH] = disk_idx;
@@ -749,7 +805,13 @@
HRD_history[iindex] = 0;
return ((HRDEV_DISK << HRDEV_TYPE_SHIFT) + iindex);
}
+ DEBUGMSGTL(("host/hr_disk",
+ "Get_Next_HR_Disk: can't query %s\n", string));
}
+ else {
+ DEBUGMSGTL(("host/hr_disk",
+ "Get_Next_HR_Disk: can't open %s\n", string));
+ }
HRD_history[iindex] = now;
HRD_index++;
}
@@ -801,6 +863,66 @@
return 0;
}
+#ifdef darwin
+int
+Get_HR_Disk_Label(char *string, size_t str_len, const char *devfull)
+{
+ DASessionRef sess_ref;
+ DADiskRef disk;
+ CFDictionaryRef desc;
+ CFStringRef str_ref;
+ CFStringEncoding sys_encoding = CFStringGetSystemEncoding();
+
+ DEBUGMSGTL(("host/hr_disk", "Disk Label type %s\n", devfull));
+
+ sess_ref = DASessionCreate( NULL );
+ if (NULL == sess_ref) {
+ strncpy(string, devfull, str_len);
+ string[str_len-1] = 0;
+ return -1;
+ }
+
+ disk = DADiskCreateFromBSDName( NULL, sess_ref, devfull );
+ if (NULL == disk) {
+ CFRelease(sess_ref);
+ strncpy(string, devfull, str_len);
+ string[str_len-1] = 0;
+ return -1;
+ }
+
+ desc = DADiskCopyDescription( disk );
+ if (NULL == desc) {
+ snmp_log(LOG_ERR,
+ "diskmgr: couldn't get disk description for %s, skipping\n",
+ devfull);
+ CFRelease(disk);
+ CFRelease(sess_ref);
+ strncpy(string, devfull, str_len);
+ return -1;
+ }
+
+ /** model */
+ str_ref = (CFStringRef)
+ CFDictionaryGetValue(desc, kDADiskDescriptionMediaNameKey);
+ if (str_ref) {
+ strncpy(string, CFStringGetCStringPtr(str_ref, sys_encoding),
+ str_len);
+ string[str_len-1] = 0;
+ DEBUGMSGTL(("verbose:diskmgr:darwin", " name %s\n", string));
+ }
+ else {
+ strncpy(string, devfull, str_len);
+ string[str_len-1] = 0;
+ }
+
+ CFRelease(disk);
+ CFRelease(desc);
+ CFRelease(sess_ref);
+
+ return 0;
+}
+#endif
+
static void
Save_HR_Disk_Specific(void)
{
@@ -822,6 +944,13 @@
#ifdef DIOCGDINFO
HRD_savedCapacity = HRD_info.d_secperunit / 2;
#endif
+#ifdef darwin
+ HRD_savedCapacity = HRD_cap / 1024;
+ HRD_saved_access = HRD_access;
+ HRD_saved_type = HRD_type;
+ HRD_saved_removeble = HRD_removeble;
+#endif
+
}
static void
@@ -845,6 +974,11 @@
sizeof(HRD_savedModel)-1);
HRD_savedModel[ sizeof(HRD_savedModel)-1 ] = 0;
#endif
+#ifdef darwin
+ strncpy(HRD_savedModel, HRD_model,
+ sizeof(HRD_savedModel)-1);
+ HRD_savedModel[ sizeof(HRD_savedModel)-1 ] = 0;
+#endif
}
static const char *
@@ -900,6 +1034,104 @@
result = ioctl(fd, DIOCGDINFO, &HRD_info);
#endif
+#ifdef darwin
+ DASessionRef sess_ref;
+ DADiskRef disk;
+ CFDictionaryRef desc;
+ CFStringRef str_ref;
+ CFNumberRef number_ref;
+ CFBooleanRef bool_ref;
+ CFStringEncoding sys_encoding = CFStringGetSystemEncoding();
+
+ sess_ref = DASessionCreate( NULL );
+ if (NULL == sess_ref)
+ return -1;
+
+ disk = DADiskCreateFromBSDName( NULL, sess_ref, devfull );
+ if (NULL == disk) {
+ CFRelease(sess_ref);
+ return -1;
+ }
+
+ desc = DADiskCopyDescription( disk );
+ if (NULL == desc) {
+ CFRelease(disk);
+ CFRelease(sess_ref);
+ return -1;
+ }
+
+ number_ref = (CFNumberRef)
+ CFDictionaryGetValue(desc, kDADiskDescriptionMediaSizeKey);
+ if (number_ref)
+ CFNumberGetValue(number_ref, kCFNumberSInt64Type, &HRD_cap);
+ else
+ HRD_cap = 0;
+ DEBUGMSGTL(("verbose:diskmgr:darwin", " size %lld\n", HRD_cap));
+
+ /** writable? */
+ bool_ref = (CFBooleanRef)
+ CFDictionaryGetValue(desc, kDADiskDescriptionMediaWritableKey);
+ if (bool_ref) {
+ HRD_access = CFBooleanGetValue(bool_ref);
+ }
+ else
+ HRD_access = 0;
+ DEBUGMSGTL(("verbose:diskmgr:darwin", " writable %d\n",
+ HRD_access));
+
+ /** removable? */
+ bool_ref = (CFBooleanRef)
+ CFDictionaryGetValue(desc, kDADiskDescriptionMediaRemovableKey);
+ if (bool_ref) {
+ HRD_removeble = CFBooleanGetValue(bool_ref);
+ }
+ else
+ HRD_removeble = 0;
+ DEBUGMSGTL(("verbose:diskmgr:darwin", " removable %d\n",
+ HRD_removeble));
+
+ /** get type */
+ str_ref = (CFStringRef)
+ CFDictionaryGetValue(desc, kDADiskDescriptionMediaTypeKey);
+ if (str_ref) {
+ HRD_type = _get_type_value(CFStringGetCStringPtr(str_ref,
+ sys_encoding));
+ DEBUGMSGTL(("verbose:diskmgr:darwin", " type %s / %d\n",
+ CFStringGetCStringPtr(str_ref, sys_encoding),
+ HRD_type));
+ }
+ else {
+ str_ref = (CFStringRef)
+ CFDictionaryGetValue(desc, kDADiskDescriptionDeviceProtocolKey);
+ if (str_ref) {
+ HRD_type =
+ _get_type_from_protocol(CFStringGetCStringPtr(str_ref,
+ sys_encoding));
+ DEBUGMSGTL(("verbose:diskmgr:darwin", " type %s / %d\n",
+ CFStringGetCStringPtr(str_ref, sys_encoding),
+ HRD_type));
+ }
+ else
+ HRD_type = HRDISKSTORAGEMEDIA_UNKNOWN;
+ }
+
+ /** model */
+ str_ref = (CFStringRef)
+ CFDictionaryGetValue(desc, kDADiskDescriptionDeviceModelKey);
+ if (str_ref) {
+ strncpy(HRD_model, CFStringGetCStringPtr(str_ref, sys_encoding),
+ sizeof(HRD_model));
+ HRD_savedModel[ sizeof(HRD_savedModel)-1 ] = 0;
+ DEBUGMSGTL(("verbose:diskmgr:darwin", " model %s\n", HRD_model));
+ }
+ else
+ HRD_model[0] = 0;
+ CFRelease(disk);
+ CFRelease(desc);
+ CFRelease(sess_ref);
+ result = 0;
+#endif
+
return (result);
}
@@ -918,6 +1150,11 @@
return (2); /* read only */
#endif
+#ifdef darwin
+ if (!HRD_access)
+ return (2);
+#endif
+
return (1); /* read-write */
}
@@ -990,6 +1227,9 @@
}
#endif
+#ifdef darwin
+ return HRD_type;
+#endif
return (2); /* Unknown */
}
@@ -1020,5 +1260,63 @@
return (1); /* true */
#endif
+#ifdef darwin
+ if (HRD_removeble)
+ return (1);
+#endif
+
return (2); /* false */
}
+
+#ifdef darwin
+typedef struct type_value_map_s {
+ const char *type;
+ uint32_t value;
+} type_value_map;
+
+static type_value_map media_type_map[] = {
+ { "CD-ROM", HRDISKSTORAGEMEDIA_OPTICALDISKROM},
+ { "DVD-R", HRDISKSTORAGEMEDIA_OPTICALDISKWORM},
+ { "DVD+R", HRDISKSTORAGEMEDIA_OPTICALDISKWORM},
+};
+static int media_types = sizeof(media_type_map)/sizeof(media_type_map[0]);
+
+static int
+_get_type_value( const char *str_type )
+{
+ int i, len;
+
+ if (NULL == str_type)
+ return HRDISKSTORAGEMEDIA_UNKNOWN;
+
+ len = strlen(str_type);
+ for(i=0; i < media_types; ++i) {
+ if (0 == strcmp(media_type_map[i].type, str_type))
+ return media_type_map[i].value;
+ }
+
+ return HRDISKSTORAGEMEDIA_UNKNOWN;
+}
+
+static type_value_map proto_map[] = {
+ { "ATA", HRDISKSTORAGEMEDIA_HARDDISK},
+ { "ATAPI", HRDISKSTORAGEMEDIA_OPTICALDISKROM}
+};
+static int proto_maps = sizeof(proto_map)/sizeof(proto_map[0]);
+
+static int _get_type_from_protocol( const char *prot )
+{
+ int i, len;
+
+ if (NULL == prot)
+ return TV_FALSE;
+
+ len = strlen(prot);
+ for(i=0; i < proto_maps; ++i) {
+ if (0 == strcmp(proto_map[i].type, prot))
+ return proto_map[i].value;
+ }
+
+ return HRDISKSTORAGEMEDIA_UNKNOWN;
+}
+#endif

View File

@@ -1,134 +0,0 @@
r16804 | magfr | 2008-02-14 02:37:48 +0300 (Чтв, 14 Фев 2008) | 2 lines
NEWS: snmplib: Change CONTAINER_INSERT to not do partial inserts in containers with multiple indices when one insert fails.
http://sourceforge.net/tracker/index.php?func=detail&aid=1733344&group_id=12694&atid=112694
http://bugs.gentoo.org/show_bug.cgi?id=203127
Index: snmplib/container.c
===================================================================
--- snmplib/container.c (revision 16803)
+++ snmplib/container.c (revision 16804)
@@ -282,31 +282,41 @@
* These functions should EXACTLY match the inline version in
* container.h. If you change one, change them both.
*/
-int CONTAINER_INSERT(netsnmp_container *x, const void *k)
-{
- int rc2, rc = 0;
-
- /** start at first container */
- while(x->prev)
- x = x->prev;
- for(; x; x = x->next) {
- if ((NULL != x->insert_filter) &&
- (x->insert_filter(x,k) == 1))
- continue;
- rc2 = x->insert(x,k);
- if (rc2) {
+int CONTAINER_INSERT_HELPER(netsnmp_container* x, const void* k)
+{
+ while(x && x->insert_filter && x->insert_filter(x,k) == 1)
+ x = x->next;
+ if(x) {
+ int rc = x->insert(x,k);
+ if(rc)
snmp_log(LOG_ERR,"error on subcontainer '%s' insert (%d)\n",
- x->container_name ? x->container_name : "", rc2);
- rc = rc2;
+ x->container_name ? x->container_name : "", rc);
+ else {
+ rc = CONTAINER_INSERT_HELPER(x->next, k);
+ if(rc)
+ x->remove(x,k);
}
+ return rc;
}
- return rc;
+ return 0;
}
/*------------------------------------------------------------------
* These functions should EXACTLY match the inline version in
* container.h. If you change one, change them both.
*/
+int CONTAINER_INSERT(netsnmp_container* x, const void* k)
+{
+ /** start at first container */
+ while(x->prev)
+ x = x->prev;
+ return CONTAINER_INSERT_HELPER(x, k);
+}
+
+/*------------------------------------------------------------------
+ * These functions should EXACTLY match the inline version in
+ * container.h. If you change one, change them both.
+ */
int CONTAINER_REMOVE(netsnmp_container *x, const void *k)
{
int rc2, rc = 0;
Index: include/net-snmp/library/container.h
===================================================================
--- include/net-snmp/library/container.h (revision 16803)
+++ include/net-snmp/library/container.h (revision 16804)
@@ -364,32 +364,43 @@
* container.c. If you change one, change them both.
*/
NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
- int CONTAINER_INSERT(netsnmp_container *x, const void *k)
+ int CONTAINER_INSERT_HELPER(netsnmp_container* x, const void* k)
{
- int rc2, rc = 0;
-
- /** start at first container */
- while(x->prev)
- x = x->prev;
- for(; x; x = x->next) {
- if ((NULL != x->insert_filter) &&
- (x->insert_filter(x,k) == 1))
- continue;
- rc2 = x->insert(x,k);
- if (rc2) {
+ while(x && x->insert_filter && x->insert_filter(x,k) == 1)
+ x = x->next;
+ if(x) {
+ int rc = x->insert(x,k);
+ if(rc)
snmp_log(LOG_ERR,"error on subcontainer '%s' insert (%d)\n",
- x->container_name ? x->container_name : "", rc2);
- rc = rc2;
+ x->container_name ? x->container_name : "", rc);
+ else {
+ rc = CONTAINER_INSERT_HELPER(x->next, k);
+ if(rc)
+ x->remove(x,k);
}
+ return rc;
}
- return rc;
+ return 0;
}
-
+
/*------------------------------------------------------------------
* These functions should EXACTLY match the function version in
* container.c. If you change one, change them both.
*/
NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
+ int CONTAINER_INSERT(netsnmp_container* x, const void* k)
+ {
+ /** start at first container */
+ while(x->prev)
+ x = x->prev;
+ return CONTAINER_INSERT_HELPER(x, k);
+ }
+
+ /*------------------------------------------------------------------
+ * These functions should EXACTLY match the function version in
+ * container.c. If you change one, change them both.
+ */
+ NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
int CONTAINER_REMOVE(netsnmp_container *x, const void *k)
{
int rc2, rc = 0;

View File

@@ -1,33 +0,0 @@
Index: net-snmp-5.4.1/configure.in
===================================================================
--- net-snmp-5.4.1.orig/configure.in
+++ net-snmp-5.4.1/configure.in
@@ -2,7 +2,7 @@
# the Net-SNMP's COPYING file for more details and other copyrights
# that may apply:
#
-# Portions Copyright <20> 2003 Sun Microsystems, Inc. All rights reserved.
+# Portions Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms specified in the COPYING file
# distributed with the Net-SNMP package.
#
@@ -3097,8 +3097,8 @@ fi
# check needed functions
if test "x$embed_perl" != "xno" ; then
- OLDLDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $netsnmp_perlldopts"
+ OLDLIBS="$LIBS"
+ LIBS="$LIBS $netsnmp_perlldopts"
# newer perl vs older perl call functions
AC_CHECK_FUNCS(eval_pv)
@@ -3109,7 +3109,7 @@ if test "x$embed_perl" != "xno" ; then
AC_CHECK_FUNC(perl_eval_pv, AC_DEFINE(HAVE_PERL_EVAL_PV_LC))
AC_CHECK_FUNC(Perl_eval_pv, AC_DEFINE(HAVE_PERL_EVAL_PV_UC))
- LDFLAGS="$OLDLDFLAGS"
+ LIBS="$OLDLIBS"
if test "x$ac_cv_func_perl_eval_pv" != "xyes" -a "x$ac_cv_func_Perl_eval_pv" != "xyes" -a "x$ac_cv_func_eval_pv" != "xyes" ; then

View File

@@ -1,52 +0,0 @@
r16705 | tanders | 2007-09-21 01:55:49 +0400 (Птн, 21 Сен 2007) | 3 lines
CHANGES: snmpd: PATCH: 1746831: from cunnijd: fix process checking race
condition under Linux and platform #ifdefs
--- agent/mibgroup/ucd-snmp/proc.c (revision 16704)
+++ agent/mibgroup/ucd-snmp/proc.c (revision 16705)
@@ -427,7 +427,7 @@
return count;
}
-#elif OSTYPE == NETSNMP_LINUXID
+#elif NETSNMP_OSTYPE == NETSNMP_LINUXID
#include <dirent.h>
#include <fcntl.h>
@@ -452,7 +452,7 @@
#ifdef USE_PROC_CMDLINE /* old method */
/* read /proc/XX/cmdline */
sprintf(cmdline,"/proc/%s/cmdline",ent->d_name);
- if((fd = open(cmdline, O_RDONLY)) < 0) break;
+ if((fd = open(cmdline, O_RDONLY)) < 0) continue;
len = read(fd,cmdline,sizeof(cmdline) - 1);
close(fd);
if(len <= 0) continue;
@@ -464,7 +464,7 @@
/* read /proc/XX/status */
sprintf(cmdline,"/proc/%s/status",ent->d_name);
if ((status = fopen(cmdline, "r")) == NULL)
- break;
+ continue;
if (fgets(cmdline, sizeof(cmdline), status) == NULL) {
fclose(status);
break;
@@ -507,7 +507,7 @@
return total;
}
-#elif OSTYPE == NETSNMP_ULTRIXID
+#elif NETSNMP_OSTYPE == NETSNMP_ULTRIXID
#define NPROCS 32 /* number of proces to read at once */
@@ -688,7 +688,7 @@
return (0);
return (1);
}
-#elif OSTYPE == NETSNMP_SOLARISID
+#elif NETSNMP_OSTYPE == NETSNMP_SOLARISID
#ifdef _SLASH_PROC_METHOD_

View File

@@ -1,56 +0,0 @@
From: Gordon Malm <gengor@gentoo.org>
Detect lm_sensors version and build accordingly.
--- a/agent/mibgroup/hardware/sensors.h
+++ b/agent/mibgroup/hardware/sensors.h
@@ -1,13 +1,21 @@
config_require(hardware/sensors/hw_sensors)
#if defined(solaris)
+
# if defined(HAVE_PICL_H)
config_require(hardware/sensors/picld_sensors)
# else
config_require(hardware/sensors/kstat_sensors)
# endif
+
#else
+
+# if defined(HAVE_LMSENSORS_V2)
+config_require(hardware/sensors/lmsensors_v2)
+# else
config_require(hardware/sensors/lmsensors_v3)
+# endif
+
#endif
//config_require(hardware/sensors/dummy_sensors)
--- a/configure.in
+++ b/configure.in
@@ -1909,6 +1909,25 @@ done
AC_MSG_RESULT([$new_module_list.])
+echo " $new_module_list " | $GREP "ucd-snmp/lmsensorsMib" > /dev/null
+if test $? -eq 0 ; then
+ case $target_os in
+ linux*)
+ AC_CHECK_HEADER(sensors/sensors.h,,[AC_MSG_ERROR([asked to use lm_sensors but I couldn't find sensors/sensors.h])])
+
+ AC_MSG_CHECKING([lm_sensors version])
+ AC_EGREP_CPP(lmsensors_v2,[
+#include <sensors/sensors.h>
+#if SENSORS_API_VERSION < 0x400
+lmsensors_v2
+#endif
+ ], [AC_DEFINE([HAVE_LMSENSORS_V2], [1], [Define if lm_sensors version 2.x])]
+ have_lmsensors_ver="2.x", have_lmsensors_ver="3.x or higher")
+ AC_MSG_RESULT([$have_lmsensors_ver])
+ ;;
+ esac
+fi
+
#---------------------
# loop over module list
#

File diff suppressed because it is too large Load Diff

View File

@@ -1,17 +0,0 @@
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;
}

View File

@@ -1,59 +0,0 @@
Submitted By: Mario Fetka (mario dot fetka at gmail dot com)
Date: 2008-11-04
Initial Package Version: 5.4.1.1
Origin: http://wraptastic.org/pub/jbj/rpm514-netsnmp-5.4.1.1.patch
Upstream Status: unknown
Description: hack to compile against rpm 5.1
diff -Naur net-snmp-5.4.1.1.orig/agent/mibgroup/host/hr_swinst.c net-snmp-5.4.1.1/agent/mibgroup/host/hr_swinst.c
--- net-snmp-5.4.1.1.orig/agent/mibgroup/host/hr_swinst.c 2006-12-12 23:55:46.000000000 +0000
+++ net-snmp-5.4.1.1/agent/mibgroup/host/hr_swinst.c 2008-11-03 23:19:29.305010591 +0000
@@ -41,8 +41,10 @@
#endif
#ifdef HAVE_LIBRPM
+#include <stdio.h>
+#include <stdint.h>
#include <rpm/rpmlib.h>
-#include <rpm/header.h>
+#include <rpm/rpm4compat.h>
#include <fcntl.h>
#ifdef HAVE_RPMGETPATH
@@ -465,6 +467,7 @@
if ( headerGetEntry(swi->swi_h, RPMTAG_INSTALLTIME, NULL, (void **) &rpm_data, NULL) ) {
time_t installTime = *rpm_data;
ret = date_n_time(&installTime, var_len);
+ free((void *)rpm_data);
} else {
ret = date_n_time(0, var_len);
}
@@ -661,6 +664,9 @@
NULL);
snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", n, v, r);
swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
+ free((void *)n);
+ free((void *)v);
+ free((void *)r);
}
#else
snprintf(swi->swi_name, sizeof(swi->swi_name), swi->swi_dep->d_name);
diff -Naur net-snmp-5.4.1.1.orig/configure.in net-snmp-5.4.1.1/configure.in
--- net-snmp-5.4.1.1.orig/configure.in 2008-05-14 00:49:57.000000000 +0000
+++ net-snmp-5.4.1.1/configure.in 2008-11-03 23:22:44.126003483 +0000
@@ -2760,12 +2760,12 @@
fi
])
-AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
+AC_CHECK_HEADERS(rpm/rpmlib.h rpm/rpmtag.h)
AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
-AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
+AC_CHECK_HEADER(rpm/rpmtag.h,rpmtag_h=yes,rpmtag_h=no)
-if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
+if test "x$rpmtag_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
if test "x$with_rpm" = "xyes" ; then
AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
else

View File

@@ -1,475 +0,0 @@
diff -Naur net-snmp-5.1.1.old/agent/mibgroup/host/hr_sensor.c net-snmp-5.1.1/agent/mibgroup/host/hr_sensor.c
--- net-snmp-5.1.1.old/agent/mibgroup/host/hr_sensor.c 1970-01-01 02:00:00.000000000 +0200
+++ net-snmp-5.1.1/agent/mibgroup/host/hr_sensor.c 2003-10-21 12:49:57.000000000 +0300
@@ -0,0 +1,322 @@
+/* This file was generated by mib2c and is intended for use as a mib module
+ for the ucd-snmp snmpd agent. */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <getopt.h>
+#include <errno.h>
+#include <dlfcn.h>
+
+#include "sensors/sensors.h"
+#include "sensors/error.h"
+
+#include "host_res.h"
+#include "hr_sensor.h"
+
+
+/*
+ * hr_sensor_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+
+oid hr_sensor_variables_oid[] = { 1,3,6,1,2,1,25,8 };
+
+
+/*
+ * variable2 hr_sensor_variables:
+ * this variable defines function callbacks and type return information
+ * for the hr_sensor mib section
+ */
+
+
+struct variable2 hr_sensor_variables[] = {
+ /* magic number , variable type , ro/rw , callback fn , L, oidsuffix */
+#define HRSENSORMAPPING 2
+ { HRSENSORMAPPING, ASN_INTEGER , RONLY , var_hr_sensor, 2, { 1,1 } },
+#define HRSENSORNUMBER 3
+ { HRSENSORNUMBER, ASN_INTEGER , RONLY , var_hr_sensor, 2, { 1,2 } },
+#define HRSENSORNAME 4
+ { HRSENSORNAME , ASN_OCTET_STR , RONLY , var_hr_sensor, 2, { 1,3 } },
+#define HRSENSORLABEL 5
+ { HRSENSORLABEL , ASN_OCTET_STR , RONLY , var_hr_sensor, 2, { 1,4 } },
+#define HRSENSORVALUE 6
+ { HRSENSORVALUE , ASN_OCTET_STR , RONLY , var_hr_sensor, 2, { 1,5 } },
+
+};
+/* (L = length of the oidsuffix) */
+
+
+#define DEFAULT_CONFIG_FILE_NAME "sensors.conf"
+
+static char *config_file_name;
+FILE *config_file;
+static const char *config_file_path[] =
+{ "/etc", "/usr/lib/sensors", "/usr/local/lib/sensors", "/usr/lib",
+ "/usr/local/lib", ".", 0 };
+
+static void open_config_file(void);
+static int open_this_config_file(char *filename);
+
+
+/*
+ * functions that are dynamically loaded if the lm_sensors library is
+ * installed.
+ */
+static int (*sensors_get_label_dl)(sensors_chip_name name, int feature,
+ char **result);
+static int (*sensors_init_dl)(FILE *input);
+static int (*sensors_get_feature_dl)(sensors_chip_name name, int feature,
+ double *result);
+static const sensors_feature_data *(*sensors_get_all_features_dl)
+ (sensors_chip_name name, int *nr1,int *nr2);
+static const sensors_chip_name *(*sensors_get_detected_chips_dl)(int *nr);
+
+#define CHIPS_MAX 20
+static sensors_chip_name chips[CHIPS_MAX];
+static int chips_count=0;
+static int do_sets;
+
+/* This examines global var config_file, and leaves the name there too.
+ It also opens config_file. */
+static void open_config_file(void)
+{
+#define MAX_FILENAME_LEN 1024
+ char *filename;
+ char buffer[MAX_FILENAME_LEN];
+ int res,i;
+
+ if (config_file_name && !strcmp(config_file_name,"-")) {
+ config_file = stdin;
+ return;
+ } else if (config_file_name && index(config_file_name,'/')) {
+ if ((res = open_this_config_file(config_file_name))) {
+ fprintf(stderr,"Could not locate or open config file\n");
+ fprintf(stderr,"%s: %s\n",config_file_name,strerror(res));
+ exit(1);
+ }
+ }
+ else {
+ if (config_file_name)
+ filename = config_file_name;
+ else
+ filename = strdup(DEFAULT_CONFIG_FILE_NAME);
+ for (i = 0; config_file_path[i]; i++) {
+ if ((snprintf(buffer,MAX_FILENAME_LEN,
+ "%s/%s",config_file_path[i],filename)) < 1) {
+ fprintf(stderr,
+ "open_config_file: ridiculous long config file name!\n");
+ exit(1);
+ }
+ if (!open_this_config_file(buffer)) {
+ free(config_file_name);
+ config_file_name = strdup(buffer);
+ return;
+ }
+ }
+ fprintf(stderr,"Could not locate or open config file!\n");
+ exit(1);
+ }
+}
+
+static int open_this_config_file(char *filename)
+{
+ config_file = fopen(filename,"r");
+ if (! config_file)
+ return -errno;
+ return 0;
+}
+
+static long *sensor_tbl = 0;
+sensors_chip_name *chip_tbl = 0;
+static int sensor_maxnum = 0;
+
+static void do_register(sensors_chip_name name)
+{
+ const char *algo,*adap;
+
+ {
+ const sensors_feature_data *sensor;
+ const char *map=0;
+ int index0 = 0, index1 = 0;
+
+ printf("%s\n", name);
+
+ while ((sensor = sensors_get_all_features_dl (name, &index0, &index1))
+ != NULL) {
+ if(sensor_tbl = realloc(sensor_tbl, sizeof(long) * (sensor_maxnum+2)))
+ sensor_tbl[sensor_maxnum] = sensor->number;
+ if (chip_tbl = realloc(chip_tbl, sizeof(sensors_chip_name) * (sensor_maxnum+2)))
+ chip_tbl[sensor_maxnum] = name;
+ sensor_maxnum++;
+ }
+ }
+}
+
+/*
+ * init_hr_sensor():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void init_hr_sensor(void) {
+
+ const sensors_chip_name *chip;
+ int chip_nr,i;
+ int c,res;
+ void *sensors_library;
+
+ /* This could probably due with a bit more error reporting. */
+ sensors_library=dlopen("libsensors.so",RTLD_LAZY);
+ if(sensors_library==NULL)
+ return; // return before anything is registered
+
+ sensors_get_label_dl=dlsym(sensors_library,"sensors_get_label");
+ sensors_init_dl=dlsym(sensors_library,"sensors_init");
+ sensors_get_feature_dl=dlsym(sensors_library,"sensors_get_feature");
+ sensors_get_all_features_dl=dlsym(sensors_library,
+ "sensors_get_all_features");
+ sensors_get_detected_chips_dl=dlsym(sensors_library,
+ "sensors_get_detected_chips");
+ if(sensors_get_label_dl==NULL || sensors_init_dl==NULL ||
+ sensors_get_feature_dl==NULL || sensors_get_all_features_dl==NULL ||
+ sensors_get_detected_chips_dl==NULL)
+ return; // return before anything is registered
+
+ /* register ourselves with the agent to handle our mib tree */
+ REGISTER_MIB("hr_sensor", hr_sensor_variables, variable2,
+ hr_sensor_variables_oid);
+
+
+ /* place any other initialization junk you need here */
+
+
+ chips[0].prefix = SENSORS_CHIP_NAME_PREFIX_ANY;
+ chips[0].bus = SENSORS_CHIP_NAME_BUS_ANY;
+ chips[0].addr = SENSORS_CHIP_NAME_ADDR_ANY;
+ chips_count = 1;
+
+ open_config_file();
+
+ if ((res = sensors_init_dl(config_file))) {
+ return;
+ }
+
+ for (chip_nr = 0; (chip = sensors_get_detected_chips_dl(&chip_nr));)
+ do_register (*chip);
+}
+
+
+/*
+ * var_hr_sensor():
+ * This function is called every time the agent gets a request for
+ * a scalar variable that might be found within your mib section
+ * registered above. It is up to you to do the right thing and
+ * return the correct value.
+ * You should also correct the value of "var_len" if necessary.
+ *
+ * Please see the documentation for more information about writing
+ * module extensions, and check out the examples in the examples
+ * and mibII directories.
+ */
+unsigned char *
+var_hr_sensor(struct variable *vp,
+ oid *name,
+ size_t *length,
+ int exact,
+ size_t *var_len,
+ WriteMethod **write_method)
+{
+ /* variables we may use later */
+ static long long_ret;
+ static char *string = 0;
+ static oid objid[MAX_OID_LEN];
+ static struct counter64 c64;
+
+ const sensors_feature_data *sensor;
+ const char *map=0;
+ int index0 = 0, index1 = 0;
+ int sensor_idx = 0, sensor_num = 0;
+ sensors_chip_name chip_name;
+ double value;
+
+
+ if (header_simple_table(vp,name,length,exact,var_len,write_method,sensor_maxnum)
+ == MATCH_FAILED )
+ return NULL;
+
+ sensor_idx = name[*length - 1] - 1;
+ sensor_num = sensor_tbl[sensor_idx];
+ chip_name = chip_tbl[sensor_idx];
+
+ while ((sensor = sensors_get_all_features_dl (chip_name, &index0, &index1))
+ != NULL) {
+ if(sensor_num == sensor->number) {
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch(vp->magic) {
+
+
+ case HRSENSORMAPPING:
+
+ long_ret = sensor->mapping;
+ return (unsigned char *) &long_ret;
+
+ case HRSENSORNUMBER:
+
+ long_ret = sensor_num;
+ return (unsigned char *) &long_ret;
+
+ case HRSENSORNAME:
+
+ string = malloc(SPRINT_MAX_LEN);
+ strncpy(string, sensor->name, SPRINT_MAX_LEN);
+ *var_len = strlen(string);
+ return (unsigned char *) string;
+
+ case HRSENSORLABEL:
+
+ string = malloc(SPRINT_MAX_LEN);
+
+ if (sensors_get_label_dl (chip_name, sensor->number, &string)) {
+ return 0;
+ }
+
+ *var_len = strlen(string);
+ return (unsigned char *) string;
+
+ case HRSENSORVALUE:
+
+ if (!(sensor->mode & SENSORS_MODE_R)) {
+ return 0;
+ } else if (!(sensor->mode & SENSORS_MODE_R)) {
+ return 0;
+ } else if (sensors_get_feature_dl (chip_name, sensor->number, &value)){
+ return 0;
+ }
+ string = malloc(SPRINT_MAX_LEN);
+ snprintf(string, SPRINT_MAX_LEN, "%f", value);
+ *var_len = strlen(string);
+ return (unsigned char *) string;
+
+ default:
+ ERROR_MSG("");
+ return NULL;
+ }
+ }
+ }
+ return NULL;
+}
+
diff -Naur net-snmp-5.1.1.old/agent/mibgroup/host/hr_sensor.h net-snmp-5.1.1/agent/mibgroup/host/hr_sensor.h
--- net-snmp-5.1.1.old/agent/mibgroup/host/hr_sensor.h 1970-01-01 02:00:00.000000000 +0200
+++ net-snmp-5.1.1/agent/mibgroup/host/hr_sensor.h 2003-10-21 12:47:04.000000000 +0300
@@ -0,0 +1,24 @@
+/* This file was generated by mib2c and is intended for use as a mib module
+ for the ucd-snmp snmpd agent. */
+
+
+#ifndef _MIBGROUP_HRSENSOR_H
+#define _MIBGROUP_HRSENSOR_H
+
+
+/* we may use header_generic and header_simple_table from the util_funcs module */
+
+
+config_require(util_funcs)
+
+
+/* function prototypes */
+
+
+extern void init_hr_sensor(void);
+extern FindVarMethod var_hr_sensor;
+
+
+
+
+#endif /* _MIBGROUP_HRSENSOR_H */
diff -Naur net-snmp-5.1.1.old/agent/mibgroup/host.h net-snmp-5.1.1/agent/mibgroup/host.h
--- net-snmp-5.1.1.old/agent/mibgroup/host.h 2002-04-20 10:30:00.000000000 +0300
+++ net-snmp-5.1.1/agent/mibgroup/host.h 2003-10-21 12:47:04.000000000 +0300
@@ -15,6 +15,7 @@
config_require(host/hr_filesys)
config_require(host/hr_swrun)
config_require(host/hr_swinst)
+ config_require(host/hr_sensor)
/* add the host resources mib to the default mibs to load */
config_add_mib(HOST-RESOURCES-MIB)
diff -Naur net-snmp-5.1.1.old/mibs/HOST-RESOURCES-MIB.txt net-snmp-5.1.1/mibs/HOST-RESOURCES-MIB.txt
--- net-snmp-5.1.1.old/mibs/HOST-RESOURCES-MIB.txt 2002-04-20 10:30:15.000000000 +0300
+++ net-snmp-5.1.1/mibs/HOST-RESOURCES-MIB.txt 2003-10-21 12:47:04.000000000 +0300
@@ -106,6 +106,7 @@
hrSWRunPerf OBJECT IDENTIFIER ::= { host 5 }
hrSWInstalled OBJECT IDENTIFIER ::= { host 6 }
hrMIBAdminInfo OBJECT IDENTIFIER ::= { host 7 }
+hrSensor OBJECT IDENTIFIER ::= { host 8 }
-- textual conventions
@@ -1390,6 +1391,66 @@
(hex)'00 00 01 01 00 00 00 00'."
::= { hrSWInstalledEntry 5 }
+
+hrSensorEntry OBJECT-TYPE
+ SYNTAX hrSensorEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "The CPU temperature sensor settings."
+ INDEX { hrSensor }
+ ::= { hrSensor 1 }
+
+hrSensorEntry ::= SEQUENCE {
+ hrSensorNumber Integer32,
+ hrSensorMapping Integer32,
+ hrSensorName DisplayString,
+ hrSensorLabel DisplayString,
+ hrSensorValue DisplayString
+ }
+
+
+
+hrSensorMapping OBJECT-TYPE
+ SYNTAX Integer32 (1..2147483647)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The mapping"
+ ::= { hrSensorEntry 1 }
+
+hrSensorNumber OBJECT-TYPE
+ SYNTAX Integer32 (1..2147483647)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The Number"
+ ::= { hrSensorEntry 2 }
+
+hrSensorName OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The name of the sensor."
+ ::= { hrSensorEntry 3 }
+
+hrSensorLabel OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The label of the sensor."
+ ::= { hrSensorEntry 4 }
+
+hrSensorValue OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The value of the sensor"
+ ::= { hrSensorEntry 5 }
+
-- Conformance information
hrMIBCompliances OBJECT IDENTIFIER ::= { hrMIBAdminInfo 2 }
@@ -1456,6 +1517,13 @@
"The Installed Software Group.
Implementation of this group is at the discretion
of the implementor."
+
+ GROUP hrSensorGroup
+ DESCRIPTION
+ "The Sensors Group.
+ Implementation of this group is at the discretion
+ of the implementor."
+
::= { hrMIBCompliances 1 }
hrSystemGroup OBJECT-GROUP
@@ -1537,4 +1605,17 @@
"The Host Resources Installed Software Group."
::= { hrMIBGroups 6 }
+ hrSensorGroup OBJECT-GROUP
+ OBJECTS {
+ hrSensorEntry,
+ hrSensorNumber,
+ hrSensorMapping,
+ hrSensorName,
+ hrSensorLabel,
+ hrSensorValue
+ }
+ STATUS current
+ DESCRIPTION
+ "The Sensor Resources Group."
+ ::= { hrMIBGroups 7 }
END

View File

@@ -1,246 +0,0 @@
--- net-snmp-5.4.1.1/agent/mibgroup/host/hr_swinst.c.jbj 2008-09-06 09:11:42.000000000 -0400
+++ net-snmp-5.4.1.1/agent/mibgroup/host/hr_swinst.c 2008-09-06 09:12:11.000000000 -0400
@@ -41,8 +41,10 @@
#endif
#ifdef HAVE_LIBRPM
+#include <stdio.h>
+#include <stdint.h>
#include <rpm/rpmlib.h>
-#include <rpm/header.h>
+#include <rpm/rpm4compat.h>
#include <fcntl.h>
#ifdef HAVE_RPMGETPATH
@@ -465,6 +467,7 @@ var_hrswinst(struct variable * vp,
if ( headerGetEntry(swi->swi_h, RPMTAG_INSTALLTIME, NULL, (void **) &rpm_data, NULL) ) {
time_t installTime = *rpm_data;
ret = date_n_time(&installTime, var_len);
+ free((void *)rpm_data);
} else {
ret = date_n_time(0, var_len);
}
@@ -661,6 +664,9 @@ Save_HR_SW_info(int ix)
NULL);
snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", n, v, r);
swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
+ free((void *)n);
+ free((void *)v);
+ free((void *)r);
}
#else
snprintf(swi->swi_name, sizeof(swi->swi_name), swi->swi_dep->d_name);
--- net-snmp-5.4.1.1/configure.jbj 2008-09-06 09:10:46.000000000 -0400
+++ net-snmp-5.4.1.1/configure 2008-09-06 09:14:56.000000000 -0400
@@ -25823,7 +25823,7 @@ cat >>conftest.$ac_ext <<_ACEOF
#include NETSNMP_SYSTEM_INCLUDE_FILE
#include "$srcdir/$mibdir/$i.h"
_ACEOF
- mv conftest.$ac_ext module_tmp_header.h
+ mv conftest.$ac_ext module_tmp_rpmtag.h
#---------------------
# macro: config_belongs_in(ARG)
@@ -25834,7 +25834,7 @@ _ACEOF
module_type=mib_module
if test -f $srcdir/$mibdir/$i.h; then
- module_type=`$MODULECPP module_tmp_header.h | grep config_belongs_in | sed 's@.*config_belongs_in(\([^)]*\)).*@\1@'`
+ module_type=`$MODULECPP module_tmp_rpmtag.h | grep config_belongs_in | sed 's@.*config_belongs_in(\([^)]*\)).*@\1@'`
fi
if test "x$module_type" = "x" ; then
@@ -25934,7 +25934,7 @@ _ACEOF
#
# check if $i has any conflicts
#
- new_list_excl=`$MODULECPP module_tmp_header.h | grep config_exclude | sed 's/.*config_exclude(\(.*\)).*/\1/'`
+ new_list_excl=`$MODULECPP module_tmp_rpmtag.h | grep config_exclude | sed 's/.*config_exclude(\(.*\)).*/\1/'`
if test "x$new_list_excl" != "x"; then
if test $module_debug = 1; then
@@ -25980,7 +25980,7 @@ EOF
# check if $i has any architecture specific requirements
#
- new_list_arch=`$MODULECPP module_tmp_header.h | grep config_arch_require | sed 's/.*config_arch_require( *\([^ ]*\) *, *\([^ ]*\) *).*/\1-xarchx-\2/'`
+ new_list_arch=`$MODULECPP module_tmp_rpmtag.h | grep config_arch_require | sed 's/.*config_arch_require( *\([^ ]*\) *, *\([^ ]*\) *).*/\1-xarchx-\2/'`
if test "x$new_list_arch" != "x"; then
for j in $new_list_arch
@@ -26011,7 +26011,7 @@ EOF
#
# check if $i has any other required modules
#
- new_list="$new_list `$MODULECPP module_tmp_header.h | grep config_require | sed 's/.*config_require(\(.*\)).*/\1/'`"
+ new_list="$new_list `$MODULECPP module_tmp_rpmtag.h | grep config_require | sed 's/.*config_require(\(.*\)).*/\1/'`"
if test $module_debug = 1; then
echo " $i will test: $new_list"
@@ -26072,7 +26072,7 @@ EOF
#
# check if $i has any mibs to add
#
- new_mibs=`$MODULECPP module_tmp_header.h | grep config_add_mib | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
+ new_mibs=`$MODULECPP module_tmp_rpmtag.h | grep config_add_mib | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
if test "x$new_mibs" != "x"; then
for j in $new_mibs
do
@@ -26113,7 +26113,7 @@ EOF
#-------------------
# check for unsupported config_load_mib
#
- if $MODULECPP module_tmp_header.h | grep config_load_mib > /dev/null 2>&1; then
+ if $MODULECPP module_tmp_rpmtag.h | grep config_load_mib > /dev/null 2>&1; then
{ echo "$as_me:$LINENO: WARNING: mib module error" >&5
echo "$as_me: WARNING: mib module error" >&2;}
{ echo "$as_me:$LINENO: WARNING: mib module \"$i\" uses the \"config_load_mib\" directive, which is no longer supported. It probably won't work." >&5
@@ -26125,7 +26125,7 @@ echo "$as_me: WARNING: mib module \"$i\"
# (generally not used any longer; old auto-load a .conf token)
#
- $MODULECPP module_tmp_header.h | grep config_parse_dot_conf | sed 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@' >> $mibdir/mib_module_dot_conf.h
+ $MODULECPP module_tmp_rpmtag.h | grep config_parse_dot_conf | sed 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@' >> $mibdir/mib_module_dot_conf.h
#---------------------
@@ -26134,7 +26134,7 @@ echo "$as_me: WARNING: mib module \"$i\"
#
# check if $i has any errors, or warnings
#
- error=`$MODULECPP module_tmp_header.h | grep config_error | sed 's/.*config_error(\(.*\)).*/\1/'`
+ error=`$MODULECPP module_tmp_rpmtag.h | grep config_error | sed 's/.*config_error(\(.*\)).*/\1/'`
if test "x$error" != "x"; then
echo
echo
@@ -26147,7 +26147,7 @@ echo "$as_me: error: $i: *** $error ***"
# macro: config_warning(warning text)
# - used to signal a configuration "warning" to be printed to the user
#
- warning=`$MODULECPP module_tmp_header.h | grep config_warning | sed 's/.*config_warning(\(.*\)).*/\1/'`
+ warning=`$MODULECPP module_tmp_rpmtag.h | grep config_warning | sed 's/.*config_warning(\(.*\)).*/\1/'`
if test "x$warning" != "x"; then
all_warnings="$all_warnings $warning
"
@@ -26384,7 +26384,7 @@ EOFOCFIN
done
# cleanup
-rm -f module_tmp_header.h
+rm -f module_tmp_rpmtag.h
#-------------------
# build module lists for Makefiles
@@ -28388,8 +28388,7 @@ rm -f conftest.err conftest.$ac_objext \
fi;
-
-for ac_header in rpm/rpmlib.h rpm/header.h
+for ac_header in rpm/rpmlib.h rpm/rpmtag.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -28684,8 +28683,8 @@ fi
if test "${ac_cv_header_rpm_header_h+set}" = set; then
- echo "$as_me:$LINENO: checking for rpm/header.h" >&5
-echo $ECHO_N "checking for rpm/header.h... $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for rpm/rpmtag.h" >&5
+echo $ECHO_N "checking for rpm/rpmtag.h... $ECHO_C" >&6
if test "${ac_cv_header_rpm_header_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
@@ -28693,8 +28692,8 @@ echo "$as_me:$LINENO: result: $ac_cv_hea
echo "${ECHO_T}$ac_cv_header_rpm_header_h" >&6
else
# Is the header compilable?
-echo "$as_me:$LINENO: checking rpm/header.h usability" >&5
-echo $ECHO_N "checking rpm/header.h usability... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking rpm/rpmtag.h usability" >&5
+echo $ECHO_N "checking rpm/rpmtag.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -28702,7 +28701,7 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
-#include <rpm/header.h>
+#include <rpm/rpmtag.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -28738,15 +28737,15 @@ echo "$as_me:$LINENO: result: $ac_header
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
-echo "$as_me:$LINENO: checking rpm/header.h presence" >&5
-echo $ECHO_N "checking rpm/header.h presence... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking rpm/rpmtag.h presence" >&5
+echo $ECHO_N "checking rpm/rpmtag.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <rpm/header.h>
+#include <rpm/rpmtag.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -28780,25 +28779,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
- { echo "$as_me:$LINENO: WARNING: rpm/header.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: rpm/header.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: rpm/header.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: rpm/header.h: proceeding with the compiler's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: rpm/rpmtag.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: rpm/rpmtag.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: rpm/rpmtag.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: rpm/rpmtag.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
- { echo "$as_me:$LINENO: WARNING: rpm/header.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: rpm/header.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: rpm/header.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: rpm/header.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: rpm/header.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: rpm/header.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: rpm/header.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: rpm/header.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: rpm/header.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: rpm/header.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: rpm/header.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: rpm/header.h: in the future, the compiler will take precedence" >&2;}
+ { echo "$as_me:$LINENO: WARNING: rpm/rpmtag.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: rpm/rpmtag.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: rpm/rpmtag.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: rpm/rpmtag.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: rpm/rpmtag.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: rpm/rpmtag.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: rpm/rpmtag.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: rpm/rpmtag.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: rpm/rpmtag.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: rpm/rpmtag.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: rpm/rpmtag.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: rpm/rpmtag.h: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ---------------------------------------------------- ##
@@ -28809,8 +28808,8 @@ _ASBOX
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
-echo "$as_me:$LINENO: checking for rpm/header.h" >&5
-echo $ECHO_N "checking for rpm/header.h... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking for rpm/rpmtag.h" >&5
+echo $ECHO_N "checking for rpm/rpmtag.h... $ECHO_C" >&6
if test "${ac_cv_header_rpm_header_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else

View File

@@ -1,17 +0,0 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/files/snmpd.conf,v 1.8 2006/11/26 21:37:22 cedk Exp $
# Initial (empty) options.
SNMPD_FLAGS=""
# Enable connection logging.
#SNMPD_FLAGS="${SNMPD_FLAGS} -a"
# Enable syslog and disable file log.
#SNMPD_FLAGS="${SNMPD_FLAGS} -Lsd -Lf /dev/null"
# Enable agentx socket as /var/agentx/master
# *NOTE* Before uncommenting this, make sure
# the /var/agentx directory exists.
#SNMPD_FLAGS="${SNMPD_FLAGS} -x /var/agentx/master"

View File

@@ -1,47 +0,0 @@
#!/sbin/runscript
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/files/snmpd.init,v 1.1 2009/10/16 08:51:05 gengor Exp $
opts="${opts} reload"
depend() {
use logger
need net
}
SNMPD_PIDFILE="${SNMPD_PIDFILE:-/var/run/snmpd.pid}"
checkconfig() {
if [ ! -e /etc/snmp/snmpd.conf ] ; then
eerror "${SVCNAME} requires an /etc/snmp/snmpd.conf configuration file"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --quiet --exec /usr/sbin/snmpd \
-- -p ${SNMPD_PIDFILE} ${SNMPD_FLAGS}
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --quiet --pidfile ${SNMPD_PIDFILE}
eend $?
}
reload() {
checkconfig || return 1
if [ ! -f ${SNMPD_PIDFILE} ]; then
eerror "Cannot reload configuration, ${SVCNAME} is not running"
eend 1
return 1
fi
ebegin "Reloading ${SVCNAME} configuration"
kill -HUP $(< ${SNMPD_PIDFILE}) &>/dev/null
eend $?
}

View File

@@ -1,30 +0,0 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/files/snmpd.rc7,v 1.1 2006/11/26 21:37:22 cedk Exp $
depend() {
use logger
need net
}
checkconfig() {
if [ ! -e /etc/snmp/snmpd.conf ] ; then
eerror "You need an /etc/snmp/snmpd.conf config file to run snmpd"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting net-snmpd"
start-stop-daemon --start --quiet --exec /usr/sbin/snmpd \
-- -p /var/run/snmpd.pid ${SNMPD_FLAGS}
eend $?
}
stop() {
ebegin "Stopping net-snmpd"
start-stop-daemon --stop --quiet --pidfile /var/run/snmpd.pid
eend $?
}

View File

@@ -1,16 +0,0 @@
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/files/snmptrapd.conf,v 1.1 2005/01/28 11:19:25 ka0ttic Exp $
# extra flags to pass to snmptrapd
SNMPTRAPD_FLAGS=""
# ignore authentication failure traps
#SNMPTRAPD_FLAGS="${SNMPTRAPD_FLAGS} -a"
# log messages to specified file
#SNMPTRAPD_FLAGS="${SNMPTRAPD_FLAGS} -Lf /var/log/snmptrapd.log"
# log messages to syslog with the specified facility
# where facility is: 'd' = LOG_DAEMON, 'u' = LOG_USER, [0-7] = LOG_LOCAL[0-7]
#SNMPTRAPD_FLAGS="${SNMPTRAPD_FLAGS} -Ls d"

View File

@@ -1,24 +0,0 @@
#!/sbin/runscript
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/files/snmptrapd.init,v 1.1 2009/10/16 08:51:05 gengor Exp $
depend() {
use logger
need net
}
SNMPTRAPD_PIDFILE="${SNMPTRAPD_PIDFILE:-/var/run/snmptrapd.pid}"
start() {
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --quiet --exec /usr/sbin/snmptrapd \
-- -p ${SNMPTRAPD_PIDFILE} ${SNMPTRAPD_FLAGS}
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --quiet --pidfile ${SNMPTRAPD_PIDFILE}
eend $?
}

View File

@@ -1,22 +0,0 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/files/snmptrapd.rc7,v 1.1 2006/11/26 21:37:22 cedk Exp $
depend() {
use logger
need net
}
start() {
ebegin "Starting snmptrapd"
start-stop-daemon --start --quiet --exec /usr/sbin/snmptrapd \
-- -p /var/run/snmptrapd.pid ${SNMPTRAPD_FLAGS}
eend $?
}
stop() {
ebegin "Stopping snmptrapd"
start-stop-daemon --stop --quiet --pidfile /var/run/snmptrapd.pid
eend $?
}

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>netmon</herd>
<use>
<flag name='diskio'>Enable the use of diskio mibs</flag>
<flag name='elf'>Enable the use of elf utils to check uptime on some sytems</flag>
<flag name='extensible'>build deprecated extensible mib module (extend is successor)</flag>
<flag name='mfd-rewrites'>Use MFD rewrites of mib modules where available</flag>
<flag name='rpm'>Enable the rpm snmp probing</flag>
<flag name='sendmail'>Enable sendmail statistics monitoring</flag>
<flag name='smux'>Enable the smux MIBS module</flag>
</use>
</pkgmetadata>

View File

@@ -1,204 +0,0 @@
# Copyright 1999-2010 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.2.1-r4.ebuild,v 1.2 2010/05/01 00:20:04 flameeyes Exp $
EAPI=2
inherit fixheadtails flag-o-matic perl-module python autotools
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="bzip2 diskio doc elf extensible ipv6 kernel_linux lm_sensors mfd-rewrites minimal perl python rpm selinux sendmail smux ssl tcpd X zlib"
COMMON="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
)
bzip2? ( app-arch/bzip2 )
zlib? ( >=sys-libs/zlib-1.1.4 )
elf? ( dev-libs/elfutils )
lm_sensors? (
kernel_linux? ( sys-apps/lm_sensors )
)
python? ( dev-python/setuptools )"
RDEPEND="${COMMON}
perl? (
X? ( dev-perl/perl-tk )
!minimal? ( dev-perl/TermReadKey )
)
selinux? ( sec-policy/selinux-snmpd )"
# Dependency on autoconf due to bug #225893
DEPEND="${COMMON}
>=sys-devel/autoconf-2.61-r2
>=sys-apps/sed-4
doc? ( app-doc/doxygen )"
src_prepare() {
# Fix CVE-2008-6123
epatch "${FILESDIR}"/CVE-2008-6123.patch
# lm_sensors-3 support
if use lm_sensors ; then
epatch "${FILESDIR}"/${PN}-5.4.1-sensors3.patch \
"${FILESDIR}"/${PN}-5.4.1-sensors3-version_detect.patch
fi
# 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
# snmpconf generates config files with proper selinux context
use selinux && epatch "${FILESDIR}"/${PN}-5.1.2-snmpconf-selinux.patch
# remove CFLAGS from net-snmp-config script (bug #257622):
sed -i -e 's|@CFLAGS@||g' -e 's|@LDFLAGS@||g' \
net-snmp-config.in || die "sedding CFLAGS/LDFLAGS failed"
use rpm && epatch "${FILESDIR}"/${PN}-5.4.1.1-rpm5-1.patch #202399
# Fix version number:
sed -i -e "s:NetSnmpVersionInfo = \".*\":NetSnmpVersionInfo = \"${PV}\":" \
snmplib/snmp_version.c || die "sedding version failed"
eautoreconf
ht_fix_all
}
src_configure() {
strip-flags
local mibs="host ucd-snmp/dlmod"
use diskio && mibs="${mibs} ucd-snmp/diskio"
use extensible && mibs="${mibs} ucd-snmp/extensible"
use lm_sensors && mibs="${mibs} ucd-snmp/lmsensorsMib"
use sendmail && mibs="${mibs} mibII/mta_sendmail"
use smux && mibs="${mibs} smux"
local myconf="$(use_enable ipv6) \
$(use_enable mfd-rewrites) \
$(use_enable perl embedded-perl) \
$(use_enable !ssl internal-md5) \
$(use_with elf) \
$(use_with perl perl-modules) \
$(use_with python python-modules) \
$(use_with ssl openssl) \
$(use_with tcpd libwrap)"
if use rpm ; then
myconf="${myconf} \
--with-rpm \
--with-bzip2 \
--with-zlib"
else
myconf="${myconf} \
--without-rpm \
$(use_with bzip2) \
$(use_with zlib)"
fi
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 \
${myconf}
}
src_compile() {
emake -j1 || die "emake failed"
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 () {
# bug #317965
emake -j1 DESTDIR="${D}" install || die "make install failed"
if use perl ; then
fixlocalpod
use X || rm -f "${D}"/usr/bin/tkmib
else
rm -f "${D}"/usr/bin/mib2c "${D}"/usr/bin/snmpcheck "${D}"/usr/bin/tkmib
fi
dodoc AGENT.txt ChangeLog FAQ INSTALL NEWS PORTING README* TODO || die
newdoc EXAMPLE.conf.def EXAMPLE.conf || die
use doc && { dohtml docs/html/* || die ; }
keepdir /etc/snmp /var/lib/net-snmp
newinitd "${FILESDIR}"/snmpd.init snmpd || die
newconfd "${FILESDIR}"/snmpd.conf snmpd || die
newinitd "${FILESDIR}"/snmptrapd.init snmptrapd || die
newconfd "${FILESDIR}"/snmptrapd.conf snmptrapd || die
# Remove everything not required for an agent.
# Keep only the snmpd, snmptrapd, MIBs, headers and libraries.
if use minimal; then
elog "USE='minimal' is set. Removing excess/non-minimal components."
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 || die
}
pkg_postrm() {
use python && python_mod_cleanup
}
pkg_postinst() {
elog "An example configuration file has been installed in"
elog "/etc/snmp/snmpd.conf.example."
}