diff --git a/pysnmp/proto/secmod/rfc3414/service.py b/pysnmp/proto/secmod/rfc3414/service.py index 0560dd4da..13a8bd516 100644 --- a/pysnmp/proto/secmod/rfc3414/service.py +++ b/pysnmp/proto/secmod/rfc3414/service.py @@ -902,28 +902,30 @@ def processIncomingMsg(self, snmpEngine, messageProcessingModel, errorIndication=errind.authenticationFailure ) + hash = securityParameters.getComponentByPosition(4) try: authHandler.authenticateIncomingMsg( usmUserAuthKeyLocalized, - securityParameters.getComponentByPosition(4), + hash, wholeMsg ) except error.StatusInformation: - usmStatsWrongDigests, = mibBuilder.importSymbols( - '__SNMP-USER-BASED-SM-MIB', 'usmStatsWrongDigests') - usmStatsWrongDigests.syntax += 1 - raise error.StatusInformation( - errorIndication=errind.authenticationFailure, - oid=usmStatsWrongDigests.name, - val=usmStatsWrongDigests.syntax, - securityStateReference=securityStateReference, - securityLevel=securityLevel, - contextEngineId=contextEngineId, - contextName=contextName, - msgUserName=msgUserName, - maxSizeResponseScopedPDU=maxSizeResponseScopedPDU - ) + if len(hash) != 0: # don't throw error if hash is empty (and agent returned REPORT) + usmStatsWrongDigests, = mibBuilder.importSymbols( + '__SNMP-USER-BASED-SM-MIB', 'usmStatsWrongDigests') + usmStatsWrongDigests.syntax += 1 + raise error.StatusInformation( + errorIndication=errind.authenticationFailure, + oid=usmStatsWrongDigests.name, + val=usmStatsWrongDigests.syntax, + securityStateReference=securityStateReference, + securityLevel=securityLevel, + contextEngineId=contextEngineId, + contextName=contextName, + msgUserName=msgUserName, + maxSizeResponseScopedPDU=maxSizeResponseScopedPDU + ) debug.logger & debug.flagSM and debug.logger('processIncomingMsg: incoming msg authenticated')