summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2015-11-04 20:34:28 +0000
committerelie <elie>2015-11-04 20:34:28 +0000
commit1bf79b5accd2e50b8c729d2314c293cb6792f492 (patch)
treeebb326f644811576e88bea610aa1a7a8c6e4e0f4
parentd64884692eb8baa3530f5936e1ef4df97337c3cb (diff)
downloadpysnmp-git-1bf79b5accd2e50b8c729d2314c293cb6792f492.tar.gz
fix to MIB builder to fail gracefully on corrupted MIB package encounter
-rw-r--r--CHANGES.txt1
-rw-r--r--pysnmp/smi/builder.py5
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()