fixed crash at oneliner compatibility code on EOM response

pull/45/head
elie 2015-10-10 19:21:11 +00:00
parent 886428097d
commit e3e7f0d94e
3 changed files with 41 additions and 22 deletions

View File

@ -9,6 +9,7 @@ Revision 4.3.1, work in progress
(.addAsn1MibSource(), .addMibSource(), .loadMibs())
- Fix to __doc__ use in setup.py to make -O0 installation mode working.
- Fix to ObjectIdentity->ObjectIdentifier attributes handover
- Fixed crash at oneliner compatibility code on EOM response.
Revision 4.3.0, released 28-09-2015
-----------------------------------

View File

@ -179,24 +179,35 @@ class CommandGenerator:
kwargs['lookupNames'] = False
if 'lookupValues' not in kwargs:
kwargs['lookupValues'] = False
for x in sync.getCmd(self.snmpEngine, authData, transportTarget,
ContextData(kwargs.get('contextEngineId'),
kwargs.get('contextName', null)),
*[ (x, self._null) for x in varNames ],
**kwargs):
return x
errorIndication, errorStatus, errorIndex, varBinds = None, 0, 0, []
for errorIndication, \
errorStatus, errorIndex, \
varBinds \
in sync.getCmd(self.snmpEngine, authData, transportTarget,
ContextData(kwargs.get('contextEngineId'),
kwargs.get('contextName', null)),
*[ (x, self._null) for x in varNames ],
**kwargs):
break
return errorIndication, errorStatus, errorIndex, varBinds
def setCmd(self, authData, transportTarget, *varBinds, **kwargs):
if 'lookupNames' not in kwargs:
kwargs['lookupNames'] = False
if 'lookupValues' not in kwargs:
kwargs['lookupValues'] = False
for x in sync.setCmd(self.snmpEngine, authData, transportTarget,
ContextData(kwargs.get('contextEngineId'),
kwargs.get('contextName', null)),
*varBinds,
**kwargs):
return x
errorIndication, errorStatus, errorIndex, rspVarBinds = None, 0, 0, []
for errorIndication, \
errorStatus, errorIndex, \
rspVarBinds \
in sync.setCmd(self.snmpEngine, authData, transportTarget,
ContextData(kwargs.get('contextEngineId'),
kwargs.get('contextName', null)),
*varBinds,
**kwargs):
break
return errorIndication, errorStatus, errorIndex, rspVarBinds
def nextCmd(self, authData, transportTarget, *varNames, **kwargs):
if 'lookupNames' not in kwargs:
@ -205,6 +216,7 @@ class CommandGenerator:
kwargs['lookupValues'] = False
if 'lexicographicMode' not in kwargs:
kwargs['lexicographicMode'] = False
errorIndication, errorStatus, errorIndex = None, 0, 0
varBindTable = []
for errorIndication, \
errorStatus, errorIndex, \
@ -229,6 +241,7 @@ class CommandGenerator:
kwargs['lookupValues'] = False
if 'lexicographicMode' not in kwargs:
kwargs['lexicographicMode'] = False
errorIndication, errorStatus, errorIndex = None, 0, 0
varBindTable = []
for errorIndication, \
errorStatus, errorIndex, \
@ -246,4 +259,3 @@ class CommandGenerator:
varBindTable.append(varBinds)
return errorIndication, errorStatus, errorIndex, varBindTable

View File

@ -142,14 +142,20 @@ class NotificationOriginator:
if not isinstance(notificationType, NotificationType):
notificationType = NotificationType(notificationType)
for x in sync.sendNotification(self.snmpEngine, authData,
transportTarget,
ContextData(kwargs.get('contextEngineId'),
kwargs.get('contextName', null)),
notifyType,
notificationType.addVarBinds(*varBinds),
**kwargs):
errorIndication, errorStatus, errorIndex, rspVarBinds = None, 0, 0, []
for errorIndication, \
errorStatus, errorIndex, \
rspVarBinds \
in sync.sendNotification(self.snmpEngine, authData,
transportTarget,
ContextData(
kwargs.get('contextEngineId'),
kwargs.get('contextName', null)
),
notifyType,
notificationType.addVarBinds(*varBinds),
**kwargs):
if notifyType == 'inform':
return x
return errorIndication, errorStatus, errorIndex, rspVarBinds
else:
return
break