diff options
author | elie <elie> | 2014-01-08 21:07:06 +0000 |
---|---|---|
committer | elie <elie> | 2014-01-08 21:07:06 +0000 |
commit | 1b71ab0bdff7cc75d42e200aee0c3b7bb3efbb70 (patch) | |
tree | 303dbbc65c78e26612a4e1973835fedf3b278a73 /pysnmp/entity | |
parent | 485dd54310b797877cafc2fd0769b799e956d043 (diff) | |
download | pysnmp-git-1b71ab0bdff7cc75d42e200aee0c3b7bb3efbb70.tar.gz |
passing request details to access control callback made simpler
and more stable based on request observer facility
Diffstat (limited to 'pysnmp/entity')
-rw-r--r-- | pysnmp/entity/rfc3413/cmdrsp.py | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/pysnmp/entity/rfc3413/cmdrsp.py b/pysnmp/entity/rfc3413/cmdrsp.py index 3e8d7f4c..fd3d4c0f 100644 --- a/pysnmp/entity/rfc3413/cmdrsp.py +++ b/pysnmp/entity/rfc3413/cmdrsp.py @@ -18,13 +18,13 @@ class CommandResponderBase: self.__pendingReqs = {} def handleMgmtOperation( - self, snmpEngine, stateReference, contextName, PDU, acInfo + self, snmpEngine, stateReference, contextName, PDU, acInfo ): pass def close(self, snmpEngine): snmpEngine.msgAndPduDsp.unregisterContextEngineId( self.snmpContext.contextEngineId, self.pduTypes - ) + ) self.snmpContext = self.__pendingReqs = None def sendRsp(self, snmpEngine, stateReference, @@ -129,11 +129,6 @@ class CommandResponderBase: statusInformation ) - acCtx = ( - snmpEngine, securityModel, securityName, securityLevel, - contextName, PDU.getTagSet() - ) - # 3.2.5 varBinds = v2c.apiPDU.getVarBinds(PDU) errorStatus, errorIndex = 'noError', 0 @@ -143,8 +138,8 @@ class CommandResponderBase: try: self.handleMgmtOperation( snmpEngine, stateReference, - contextName, PDU, (self.__verifyAccess, acCtx) - ) + contextName, PDU, (self.__verifyAccess, snmpEngine) + ) # SNMPv2 SMI exceptions except pysnmp.smi.error.GenError: errorIndication = sys.exc_info()[1] @@ -192,8 +187,19 @@ class CommandResponderBase: self.releaseStateInformation(stateReference) def __verifyAccess(self, name, syntax, idx, viewType, acCtx): - (snmpEngine, securityModel, securityName, securityLevel, - contextName, pduType) = acCtx + snmpEngine = acCtx + execCtx = snmpEngine.observer.getExecutionContext( + 'rfc3412.receiveMessage:request' + ) + ( securityModel, + securityName, + securityLevel, + contextName, + pduType ) = ( execCtx['securityModel'], + execCtx['securityName'], + execCtx['securityLevel'], + execCtx['contextName'], + execCtx['pdu'].getTagSet() ) try: snmpEngine.accessControlModel[self.acmID].isAccessAllowed( snmpEngine, securityModel, securityName, |