fixed truncation of sysObjectID

Resolves: #640848
This commit is contained in:
Jan Safranek 2010-10-11 12:25:21 +02:00
parent a54769e091
commit 36d59937b3
2 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,51 @@
640848: snmpd always returns an incorrect sysObjectID of ".1.3" or ".0.1"
Source: upstream, SVN rev. 19322
Index: net-snmp/agent/mibgroup/mibII/system_mib.c
===================================================================
--- net-snmp/agent/mibgroup/mibII/system_mib.c (revision 17596)
+++ net-snmp/agent/mibgroup/mibII/system_mib.c (working copy)
@@ -60,7 +57,7 @@
static char sysName[SYS_STRING_LEN] = NETSNMP_SYS_NAME;
static char sysLocation[SYS_STRING_LEN] = NETSNMP_SYS_LOC;
static oid sysObjectID[MAX_OID_LEN];
-static size_t sysObjectIDLength;
+static size_t sysObjectIDByteLength;
extern oid version_sysoid[];
extern int version_sysoid_len;
@@ -171,12 +168,11 @@
static void
system_parse_config_sysObjectID(const char *token, char *cptr)
{
- sysObjectIDLength = MAX_OID_LEN;
+ size_t sysObjectIDLength = MAX_OID_LEN;
if (!read_objid(cptr, sysObjectID, &sysObjectIDLength)) {
netsnmp_config_error("sysobjectid token not a parsable OID:\n\t%s",
cptr);
memcpy(sysObjectID, version_sysoid, version_sysoid_len * sizeof(oid));
- sysObjectIDLength = version_sysoid_len;
}
}
@@ -318,7 +314,7 @@
/* default sysObjectID */
memcpy(sysObjectID, version_sysoid, version_sysoid_len * sizeof(oid));
- sysObjectIDLength = version_sysoid_len;
+ sysObjectIDByteLength = version_sysoid_len * sizeof(oid);
{
const oid sysDescr_oid[] = { 1, 3, 6, 1, 2, 1, 1, 1 };
@@ -340,8 +336,8 @@
HANDLER_CAN_RONLY),
netsnmp_init_watcher_info6(
&sysObjectID_winfo, sysObjectID, 0, ASN_OBJECT_ID,
- WATCHER_MAX_SIZE | WATCHER_SIZE_IS_PTR,
- MAX_OID_LEN, &sysObjectIDLength));
+ WATCHER_MAX_SIZE | WATCHER_SIZE_IS_PTR,
+ MAX_OID_LEN, &sysObjectIDByteLength));
}
{
const oid sysUpTime_oid[] = { 1, 3, 6, 1, 2, 1, 1, 3 };

View File

@ -11,7 +11,7 @@
Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp
Version: 5.5
Release: 20%{?dist}
Release: 21%{?dist}
Epoch: 1
License: BSD
@ -38,6 +38,7 @@ Patch9: net-snmp-5.5-include-struct.patch
Patch10: net-snmp-5.5-mktemp-size.patch
Patch11: net-snmp-5.5-apsl-copying.patch
Patch12: net-snmp-5.5-perl-linking.patch
Patch13: net-snmp-5.5-sysobjectid-truncation.patch
Requires(post): chkconfig
Requires(preun): chkconfig
@ -174,6 +175,7 @@ Net-SNMP toolkit library.
%patch10 -p1 -b .mktemp-size
%patch11 -p1 -b .apsl
%patch12 -p1 -b .perl-linking
%patch13 -p1 -b .sysobjectid-truncation
%build
MIBS="host agentx smux \
@ -422,6 +424,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_datadir}/snmp/mibs/*
%changelog
* Mon Oct 11 2010 Jan Safranek <jsafrane@redhat.com> - 1:5.5-21
- fixed truncation of sysObjectID (#640848)
* Thu Aug 19 2010 Jan Safranek <jsafrane@redhat.com> - 1:5.5-20
- Remove rpath from net-snmp-config output (#554747)