diff options
author | Eugene M. Kim <astralblue@gmail.com> | 2017-10-10 02:33:47 -0700 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2017-10-10 11:33:47 +0200 |
commit | c954431eccf529afca724f3ccf1884fce40f5d58 (patch) | |
tree | c61167d04bc02574b92379b8a01a47bca2ea9d8b /pysnmp/smi/rfc1902.py | |
parent | 1d5af2afc0b79fd7ed5b7ea9e564932c9adfdaac (diff) | |
download | pysnmp-git-c954431eccf529afca724f3ccf1884fce40f5d58.tar.gz |
Fix OID type matching in ObjectType.resolveWithMib (#90)
That is, reverse the supertype-subtype direction in the type matching
call: Previously it was checking if the value was a supertype of OID,
whereas the correct check should be whether the value is a subtype of
OID. This had gone undetected so far because all values were of simple,
tagged types, and if a value is not an OID, their tag set differed, i.e.
neither is a subtype of the other.
Recent introduction of NetworkAddress revealed this bug: Being an
untagged Choice type, NetworkAddress's tag set is empty, and it counts
as a supertype of OID: resolveWithMib() then erroneously treated it as
an OID.
Diffstat (limited to 'pysnmp/smi/rfc1902.py')
-rw-r--r-- | pysnmp/smi/rfc1902.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pysnmp/smi/rfc1902.py b/pysnmp/smi/rfc1902.py index 61c8ad0c..57367d94 100644 --- a/pysnmp/smi/rfc1902.py +++ b/pysnmp/smi/rfc1902.py @@ -868,7 +868,7 @@ class ObjectType(object): self.__args[0].prettyPrint(), self.__args[0].getMibNode().getSyntax().__class__.__name__, self.__args[1], sys.exc_info()[1])) - if self.__args[1].isSuperTypeOf(rfc1902.ObjectIdentifier(), matchConstraints=False): + if rfc1902.ObjectIdentifier().isSuperTypeOf(self.__args[1], matchConstraints=False): self.__args[1] = ObjectIdentity(self.__args[1]).resolveWithMib(mibViewController) self.__state |= self.stClean |