summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2012-04-17 20:07:38 +0000
committerelie <elie>2012-04-17 20:07:38 +0000
commitd293ed4a154bf0b2b10a273224ba93756dfffade (patch)
tree8d1798cd0318c070acbde7e38600132a0b8daf35
parentec94fcf916f912889952b03512fab505c96b3a42 (diff)
downloadpysnmp-d293ed4a154bf0b2b10a273224ba93756dfffade.tar.gz
fix to non-MT-safe class attributes at SNMPv3 MP & SEC modules
-rw-r--r--CHANGES1
-rw-r--r--pysnmp/proto/mpmod/rfc3412.py8
-rw-r--r--pysnmp/proto/secmod/rfc3414/service.py6
3 files changed, 8 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index 1a0e9f6..7ec28f6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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.
diff --git a/pysnmp/proto/mpmod/rfc3412.py b/pysnmp/proto/mpmod/rfc3412.py
index 801fcbe..a34f8b9 100644
--- a/pysnmp/proto/mpmod/rfc3412.py
+++ b/pysnmp/proto/mpmod/rfc3412.py
@@ -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)
diff --git a/pysnmp/proto/secmod/rfc3414/service.py b/pysnmp/proto/secmod/rfc3414/service.py
index 2b614d1..586f6a3 100644
--- a/pysnmp/proto/secmod/rfc3414/service.py
+++ b/pysnmp/proto/secmod/rfc3414/service.py
@@ -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')