Standard SNMP Apps and built-in proxy now ignores malformed errorIndex

value.
pull/45/head
elie 2013-02-07 20:05:13 +00:00
parent 1b01051824
commit 47959808a9
4 changed files with 15 additions and 6 deletions

View File

@ -1,3 +1,12 @@
Revision 4.2.5rc0
-----------------
- Packet-level SNMP API (pysnmp.proto.api) getErrorIndex() method can now
be instructed to ignore portentially malformed errorIndex SNMP packet
value what sometimes happens with buggy SNMP implementations.
- Standard SNMP Apps and built-in proxy now ignores malformed errorIndex
value.
Revision 4.2.4
--------------

View File

@ -276,7 +276,7 @@ class CommandGeneratorBase:
cbFun(sendRequestHandle,
None,
pMod.apiPDU.getErrorStatus(rspPDU),
pMod.apiPDU.getErrorIndex(rspPDU),
pMod.apiPDU.getErrorIndex(rspPDU, muteErrors=True),
pMod.apiPDU.getVarBinds(rspPDU),
cbCtx)
@ -489,7 +489,7 @@ class NextCommandGenerator(NextCommandGeneratorSingleRun):
if not cbFun(sendRequestHandle, errorIndication,
pMod.apiPDU.getErrorStatus(rspPDU),
pMod.apiPDU.getErrorIndex(rspPDU),
pMod.apiPDU.getErrorIndex(rspPDU, muteErrors=True),
varBindTable, cbCtx):
debug.logger & debug.flagApp and debug.logger('_handleResponse: sendRequestHandle %s, app says to stop walking' % sendRequestHandle)
return # app says enough
@ -625,7 +625,7 @@ class BulkCommandGenerator(BulkCommandGeneratorSingleRun):
if not cbFun(sendRequestHandle, errorIndication,
pMod.apiBulkPDU.getErrorStatus(rspPDU),
pMod.apiBulkPDU.getErrorIndex(rspPDU),
pMod.apiBulkPDU.getErrorIndex(rspPDU, muteErrors=True),
varBindTable, cbCtx):
debug.logger & debug.flagApp and debug.logger('_handleResponse: sendRequestHandle %s, app says to stop walking' % sendRequestHandle)
return # app says enough

View File

@ -140,7 +140,7 @@ class NotificationOriginator:
pMod = api.protoModules[pduVersion]
self._handleResponse(metaSendPduHandle, None,
pMod.apiPDU.getErrorStatus(PDU),
pMod.apiPDU.getErrorIndex(PDU),
pMod.apiPDU.getErrorIndex(PDU,muteErrors=True),
pMod.apiPDU.getVarBinds(PDU),
cbFun, cbCtx)

View File

@ -142,7 +142,7 @@ def v1ToV2(v1Pdu, origV2Pdu=None):
if pduType in rfc3411.responseClassPDUs:
# 4.1.2.2.1&2
errorStatus = int(v1.apiPDU.getErrorStatus(v1Pdu))
errorIndex = int(v1.apiPDU.getErrorIndex(v1Pdu))
errorIndex = int(v1.apiPDU.getErrorIndex(v1Pdu, muteErrors=True))
if errorStatus == 2: # noSuchName
if origV2Pdu.tagSet == v2c.GetNextRequestPDU.tagSet:
v2VarBinds[errorIndex-1] = (
@ -271,7 +271,7 @@ def v2ToV1(v2Pdu, origV1Pdu=None):
v1.apiPDU.setErrorStatus(
v1Pdu, __v2ToV1ErrorMap[v2ErrorStatus]
)
v1.apiPDU.setErrorIndex(v1Pdu, v2c.apiPDU.getErrorIndex(v2Pdu))
v1.apiPDU.setErrorIndex(v1Pdu, v2c.apiPDU.getErrorIndex(v2Pdu, muteErrors=True))
# Translate Var-Binds
if pduType in rfc3411.responseClassPDUs and \