fix to non-MT-safe class attributes at SNMPv3 MP & SEC modules
parent
04d59af79e
commit
9f514b66d1
|
@ -26,6 +26,7 @@ Revision 4.2.2
|
|||
- When running on Python3, SMI will re-raise exceptions with the original
|
||||
traceback for easier diagnostics.
|
||||
- Out of PYTHONPATH MIB paths now supported.
|
||||
- Fix to non-MT-safe class attributes at SNMPv3 MP & SEC modules.
|
||||
- Fix to ContextName handling in bytes form whilst running Python3. Data
|
||||
mismatch error would return otherwise.
|
||||
- Fix to socket.error processing at Py3 on Windows.
|
||||
|
|
|
@ -55,7 +55,6 @@ _snmpErrors = {
|
|||
class SnmpV3MessageProcessingModel(AbstractMessageProcessingModel):
|
||||
messageProcessingModelID = univ.Integer(3) # SNMPv3
|
||||
snmpMsgSpec = SNMPv3Message
|
||||
_scopedPDU = ScopedPDU()
|
||||
_emptyStr = univ.OctetString('')
|
||||
_msgFlags = {
|
||||
0: univ.OctetString('\x00'),
|
||||
|
@ -67,6 +66,7 @@ class SnmpV3MessageProcessingModel(AbstractMessageProcessingModel):
|
|||
}
|
||||
def __init__(self):
|
||||
AbstractMessageProcessingModel.__init__(self)
|
||||
self.__scopedPDU = ScopedPDU()
|
||||
self.__engineIDs = {}
|
||||
self.__engineIDsExpQueue = {}
|
||||
self.__expirationTimer = 0
|
||||
|
@ -122,7 +122,7 @@ class SnmpV3MessageProcessingModel(AbstractMessageProcessingModel):
|
|||
debug.logger & debug.flagMP and debug.logger('prepareOutgoingMessage: using contextEngineId %r, contextName %r' % (contextEngineId, contextName))
|
||||
|
||||
# 7.1.6
|
||||
scopedPDU = self._scopedPDU
|
||||
scopedPDU = self.__scopedPDU
|
||||
scopedPDU.setComponentByPosition(0, contextEngineId)
|
||||
scopedPDU.setComponentByPosition(1, contextName)
|
||||
scopedPDU.setComponentByPosition(2)
|
||||
|
@ -196,7 +196,7 @@ class SnmpV3MessageProcessingModel(AbstractMessageProcessingModel):
|
|||
2, self._msgFlags[msgFlags & 0xfc], verifyConstraints=False
|
||||
)
|
||||
# XXX
|
||||
scopedPDU = self._scopedPDU
|
||||
scopedPDU = self.__scopedPDU
|
||||
scopedPDU.setComponentByPosition(
|
||||
0, self._emptyStr, verifyConstraints=False
|
||||
)
|
||||
|
@ -352,7 +352,7 @@ class SnmpV3MessageProcessingModel(AbstractMessageProcessingModel):
|
|||
debug.logger & debug.flagMP and debug.logger('prepareResponseMessage: using contextEngineId %r, contextName %r' % (contextEngineId, contextName))
|
||||
|
||||
# 7.1.6
|
||||
scopedPDU = self._scopedPDU
|
||||
scopedPDU = self.__scopedPDU
|
||||
scopedPDU.setComponentByPosition(0, contextEngineId)
|
||||
scopedPDU.setComponentByPosition(1, contextName)
|
||||
scopedPDU.setComponentByPosition(2)
|
||||
|
|
|
@ -40,9 +40,9 @@ class SnmpUSMSecurityModel(AbstractSecurityModel):
|
|||
aes256.Aes256.serviceID: aes256.Aes256(),
|
||||
nopriv.NoPriv.serviceID: nopriv.NoPriv()
|
||||
}
|
||||
_securityParametersSpec = UsmSecurityParameters()
|
||||
def __init__(self):
|
||||
AbstractSecurityModel.__init__(self)
|
||||
self.__securityParametersSpec = UsmSecurityParameters()
|
||||
self.__timeline = {}
|
||||
self.__timelineExpQueue = {}
|
||||
self.__expirationTimer = 0
|
||||
|
@ -277,7 +277,7 @@ class SnmpUSMSecurityModel(AbstractSecurityModel):
|
|||
errorIndication = errind.unsupportedSecurityLevel
|
||||
)
|
||||
|
||||
securityParameters = self._securityParametersSpec
|
||||
securityParameters = self.__securityParametersSpec
|
||||
|
||||
scopedPDUData = msg.setComponentByPosition(3).getComponentByPosition(3)
|
||||
scopedPDUData.setComponentByPosition(
|
||||
|
@ -487,7 +487,7 @@ class SnmpUSMSecurityModel(AbstractSecurityModel):
|
|||
try:
|
||||
securityParameters, rest = decoder.decode(
|
||||
securityParameters,
|
||||
asn1Spec=self._securityParametersSpec
|
||||
asn1Spec=self.__securityParametersSpec
|
||||
)
|
||||
except PyAsn1Error:
|
||||
snmpInASNParseErrs, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMPv2-MIB', 'snmpInASNParseErrs')
|
||||
|
|
Loading…
Reference in New Issue