diff options
-rw-r--r-- | CHANGES.txt | 1 | ||||
-rw-r--r-- | pysnmp/smi/builder.py | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 81ad7c19..8133fde5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -15,6 +15,7 @@ Repository `tarball download <http://pysnmp.cvs.sourceforge.net/viewvc/pysnmp/py - Fixed crash at oneliner compatibility code on EOM response. - Fixed crash in hlapi.transport module. - Fixed OID resolution issues that roots at node 0 and 2. +- Fix to MIB builder to fail gracefully on corrupted MIB package encounter. - Source code re-linted Revision 4.3.0, released 28-09-2015 diff --git a/pysnmp/smi/builder.py b/pysnmp/smi/builder.py index 7792d74d..7f9db701 100644 --- a/pysnmp/smi/builder.py +++ b/pysnmp/smi/builder.py @@ -127,9 +127,12 @@ class ZipMibSource(__AbstractMibSource): self.__loader = p.__loader__ self._srcName = self._srcName.replace('.', os.sep) return self - else: + elif hasattr(p, '__file__'): # Dir relative to PYTHONPATH return DirMibSource(os.path.split(p.__file__)[0]).init() + else: + raise error.MibLoadError('%s access error' % (p,)) + except ImportError: # Dir relative to CWD return DirMibSource(self._srcName).init() |