Fix crash on wrong SNMPv3 security model

Fixed crash caused by incoming SNMPv3 message
requesting SNMPv1/v2c security model
pull/186/head
Ilya Etingof 2018-08-04 20:24:26 +02:00
parent 0fba331b55
commit 8d4b25841d
3 changed files with 7 additions and 2 deletions

View File

@ -36,6 +36,8 @@ Revision 4.4.5, released 2018-07-XX
- Fixed possible infinite loop in GETBULK response PDU builder
- Fixed memory leak in the `config.delContext()` VACM management harness
- Fixed `Bits` class initialization when enumeration values are given
- Fixed crash caused by incoming SNMPv3 message requesting SNMPv1/v2c
security model
Revision 4.4.4, released 2018-01-03
-----------------------------------

View File

@ -271,7 +271,7 @@ class SnmpV1MessageProcessingModel(AbstractMessageProcessingModel):
try:
try:
smHandler = snmpEngine.securityModels[int(securityModel)]
smHandler = snmpEngine.securityModels[securityModel]
except KeyError:
raise error.StatusInformation(

View File

@ -40,8 +40,11 @@ class HeaderData(univ.Sequence):
namedtype.NamedType('msgMaxSize',
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(484, 2147483647))),
namedtype.NamedType('msgFlags', univ.OctetString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 1))),
# NOTE (etingof): constrain SNMPv3 message to only USM+ security models
# because SNMPv1/v2c seems incompatible in pysnmp implementation, not sure
# if it's intended by the SNMP standard at all...
namedtype.NamedType('msgSecurityModel',
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, 2147483647)))
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(3, 2147483647)))
)