commit python-pysnmp for openSUSE:Factory
Hello community, here is the log from the commit of package python-pysnmp for openSUSE:Factory checked in at 2019-02-11 21:27:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pysnmp (Old) and /work/SRC/openSUSE:Factory/.python-pysnmp.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-pysnmp" Mon Feb 11 21:27:28 2019 rev:12 rq:673130 version:4.4.9 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pysnmp/python-pysnmp.changes 2019-01-11 14:05:13.627815863 +0100 +++ /work/SRC/openSUSE:Factory/.python-pysnmp.new.28833/python-pysnmp.changes 2019-02-11 21:27:30.231012021 +0100 @@ -1,0 +2,11 @@ +Sat Feb 9 20:53:52 UTC 2019 - mardnh@gmx.de + +- Update to version 4.4.9 + * Made MIB loader ignoring file and directory access errors + * Added missing SNMP PDU error classes and their handling in + Command Responder + * Fixed crash on MIB load failure in case of directory access error + * Fixed socket transparency option (IPV6_TRANSPARENT) to make IPv6 + transparent operation functional + +------------------------------------------------------------------- Old: ---- pysnmp-4.4.8.tar.gz New: ---- pysnmp-4.4.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pysnmp.spec ++++++ --- /var/tmp/diff_new_pack.uZuRaj/_old 2019-02-11 21:27:30.847011688 +0100 +++ /var/tmp/diff_new_pack.uZuRaj/_new 2019-02-11 21:27:30.851011686 +0100 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pysnmp -Version: 4.4.8 +Version: 4.4.9 Release: 0 Summary: A pure-Python SNMPv1/v2c/v3 library License: BSD-2-Clause ++++++ pysnmp-4.4.8.tar.gz -> pysnmp-4.4.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysnmp-4.4.8/CHANGES.txt new/pysnmp-4.4.9/CHANGES.txt --- old/pysnmp-4.4.8/CHANGES.txt 2018-12-30 14:21:41.000000000 +0100 +++ new/pysnmp-4.4.9/CHANGES.txt 2019-02-09 16:02:16.000000000 +0100 @@ -1,4 +1,13 @@ +Revision 4.4.9, released 2019-02-09 +----------------------------------- + +- Made MIB loader ignoring file and directory access errors +- Added missing SNMP PDU error classes and their handling in Command Responder +- Fixed crash on MIB load failure in case of directory access error +- Fixed socket transparency option (IPV6_TRANSPARENT) to make IPv6 + transparent operation functional + Revision 4.4.8, released 2018-12-30 ----------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysnmp-4.4.8/pysnmp/__init__.py new/pysnmp-4.4.9/pysnmp/__init__.py --- old/pysnmp-4.4.8/pysnmp/__init__.py 2018-12-30 14:21:41.000000000 +0100 +++ new/pysnmp-4.4.9/pysnmp/__init__.py 2019-02-09 16:02:16.000000000 +0100 @@ -1,5 +1,5 @@ # http://www.python.org/dev/peps/pep-0396/ -__version__ = '4.4.8' +__version__ = '4.4.9' # backward compatibility version = tuple([int(x) for x in __version__.split('.')]) majorVersionId = version[0] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysnmp-4.4.8/pysnmp/carrier/asyncore/dgram/base.py new/pysnmp-4.4.9/pysnmp/carrier/asyncore/dgram/base.py --- old/pysnmp-4.4.8/pysnmp/carrier/asyncore/dgram/base.py 2018-12-30 14:21:41.000000000 +0100 +++ new/pysnmp-4.4.9/pysnmp/carrier/asyncore/dgram/base.py 2019-02-09 16:02:16.000000000 +0100 @@ -73,10 +73,12 @@ raise error.CarrierError('sendmsg()/recvmsg() interface is not supported by this OS and/or Python version') try: - if self.socket.family in (socket.AF_INET, socket.AF_INET6): + if self.socket.family == socket.AF_INET: self.socket.setsockopt(socket.SOL_IP, socket.IP_PKTINFO, flag) + if self.socket.family == socket.AF_INET6: self.socket.setsockopt(socket.SOL_IPV6, socket.IPV6_RECVPKTINFO, flag) + except socket.error: raise error.CarrierError('setsockopt() for %s failed: %s' % (self.socket.family == socket.AF_INET6 and "IPV6_RECVPKTINFO" or "IP_PKTINFO", sys.exc_info()[1])) @@ -94,10 +96,12 @@ ) if self.socket.family == socket.AF_INET6: self.socket.setsockopt( - socket.SOL_IPV6, socket.IP_TRANSPARENT, flag + socket.SOL_IPV6, socket.IPV6_TRANSPARENT, flag ) + except socket.error: raise error.CarrierError('setsockopt() for IP_TRANSPARENT failed: %s' % sys.exc_info()[1]) + except OSError: raise error.CarrierError('IP_TRANSPARENT socket option requires superusre previleges') @@ -113,14 +117,17 @@ def normalizeAddress(self, transportAddress): if not isinstance(transportAddress, self.addressType): transportAddress = self.addressType(transportAddress) + if not transportAddress.getLocalAddress(): transportAddress.setLocalAddress(self.getLocalAddress()) + return transportAddress def getLocalAddress(self): # one evil OS does not seem to support getsockname() for DGRAM sockets try: return self.socket.getsockname() + except Exception: return '0.0.0.0', 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysnmp-4.4.8/pysnmp/carrier/sockfix.py new/pysnmp-4.4.9/pysnmp/carrier/sockfix.py --- old/pysnmp-4.4.8/pysnmp/carrier/sockfix.py 2018-12-30 14:21:41.000000000 +0100 +++ new/pysnmp-4.4.9/pysnmp/carrier/sockfix.py 2019-02-09 16:02:16.000000000 +0100 @@ -6,14 +6,23 @@ # import socket -symbols = { +from pysnmp import debug + + +SYMBOLS = { 'IP_PKTINFO': 8, 'IP_TRANSPARENT': 19, 'SOL_IPV6': 41, 'IPV6_RECVPKTINFO': 49, - 'IPV6_PKTINFO': 50 + 'IPV6_PKTINFO': 50, + 'IPV6_TRANSPARENT': 75 } -for symbol in symbols: +for symbol, value in SYMBOLS.items(): if not hasattr(socket, symbol): - setattr(socket, symbol, symbols[symbol]) + setattr(socket, symbol, value) + + debug.logger & debug.flagIO and debug.logger( + 'WARNING: the socket module on this platform misses option %s. ' + 'Assuming its value is %d.' % (symbol, value) + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysnmp-4.4.8/pysnmp/carrier/sockmsg.py new/pysnmp-4.4.9/pysnmp/carrier/sockmsg.py --- old/pysnmp-4.4.8/pysnmp/carrier/sockmsg.py 2018-12-30 14:21:41.000000000 +0100 +++ new/pysnmp-4.4.9/pysnmp/carrier/sockmsg.py 2019-02-09 16:02:16.000000000 +0100 @@ -17,6 +17,8 @@ # import sys +from pysnmp import debug + if sys.version_info[:2] < (3, 3): # noinspection PyUnusedLocal def getRecvFrom(addressType): @@ -29,7 +31,8 @@ import ctypes import ipaddress import socket - from pysnmp.carrier import sockfix, error + from pysnmp.carrier import sockfix + from pysnmp.carrier import error uint32_t = ctypes.c_uint32 in_addr_t = uint32_t @@ -69,38 +72,58 @@ def getRecvFrom(addressType): + def recvfrom(s, sz): _to = None + data, ancdata, msg_flags, _from = s.recvmsg(sz, socket.CMSG_LEN(sz)) + for anc in ancdata: if anc[0] == socket.SOL_IP and anc[1] == socket.IP_PKTINFO: addr = in_pktinfo.from_buffer_copy(anc[2]) addr = ipaddress.IPv4Address(memoryview(addr.ipi_addr).tobytes()) _to = (str(addr), s.getsockname()[1]) + break + elif anc[0] == socket.SOL_IPV6 and anc[1] == socket.IPV6_PKTINFO: addr = in6_pktinfo.from_buffer_copy(anc[2]) addr = ipaddress.ip_address(memoryview(addr.ipi6_addr).tobytes()) _to = (str(addr), s.getsockname()[1]) + break + + debug.logger & debug.flagIO and debug.logger( + 'recvfrom: received %d octets from %s to %s; ' + 'iov blob %r' % (len(data), _from, _to, ancdata)) + return data, addressType(_from).setLocalAddress(_to) return recvfrom def getSendTo(addressType): + def sendto(s, _data, _to): ancdata = [] if type(_to) == addressType: addr = ipaddress.ip_address(_to.getLocalAddress()[0]) + else: addr = ipaddress.ip_address(s.getsockname()[0]) + if type(addr) == ipaddress.IPv4Address: _f = in_pktinfo() _f.ipi_spec_dst = in_addr.from_buffer_copy(addr.packed) ancdata = [(socket.SOL_IP, socket.IP_PKTINFO, memoryview(_f).tobytes())] + elif s.family == socket.AF_INET6 and type(addr) == ipaddress.IPv6Address: _f = in6_pktinfo() _f.ipi6_addr = in6_addr.from_buffer_copy(addr.packed) ancdata = [(socket.SOL_IPV6, socket.IPV6_PKTINFO, memoryview(_f).tobytes())] + + debug.logger & debug.flagIO and debug.logger( + 'sendto: sending %d octets to %s; address %r; ' + 'iov blob %r' % (len(_data), _to, addr, ancdata)) + return s.sendmsg([_data], ancdata, 0, _to) return sendto diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysnmp-4.4.8/pysnmp/entity/rfc3413/cmdrsp.py new/pysnmp-4.4.9/pysnmp/entity/rfc3413/cmdrsp.py --- old/pysnmp-4.4.8/pysnmp/entity/rfc3413/cmdrsp.py 2018-12-30 14:21:41.000000000 +0100 +++ new/pysnmp-4.4.9/pysnmp/entity/rfc3413/cmdrsp.py 2019-02-09 16:02:16.000000000 +0100 @@ -138,6 +138,7 @@ self.handleMgmtOperation(snmpEngine, stateReference, contextName, PDU, (self.__verifyAccess, snmpEngine)) + # SNMPv2 SMI exceptions except pysnmp.smi.error.GenError: errorIndication = sys.exc_info()[1] @@ -148,38 +149,72 @@ statusInformation['oid'] = errorIndication['oid'] statusInformation['val'] = errorIndication['val'] - # PDU-level SMI errors + # Handle PDU-level SMI errors + + except pysnmp.smi.error.TooBigError: + errorStatus, errorIndex = 'tooBig', 0 + # rfc1905: 4.2.1.3 + varBinds = [] + + # this should never bubble up, SNMP exception objects should be passed as values + except pysnmp.smi.error.NoSuchNameError: + errorStatus, errorIndex = 'noSuchName', sys.exc_info()[1]['idx'] + 1 + + except pysnmp.smi.error.BadValueError: + errorStatus, errorIndex = 'badValue', sys.exc_info()[1]['idx'] + 1 + + except pysnmp.smi.error.ReadOnlyError: + errorStatus, errorIndex = 'readOnly', sys.exc_info()[1]['idx'] + 1 + + except pysnmp.smi.error.GenError: + errorStatus, errorIndex = 'genErr', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.NoAccessError: errorStatus, errorIndex = 'noAccess', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.WrongTypeError: errorStatus, errorIndex = 'wrongType', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.WrongLengthError: errorStatus, errorIndex = 'wrongLength', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.WrongEncodingError: errorStatus, errorIndex = 'wrongEncoding', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.WrongValueError: errorStatus, errorIndex = 'wrongValue', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.NoCreationError: errorStatus, errorIndex = 'noCreation', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.InconsistentValueError: errorStatus, errorIndex = 'inconsistentValue', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.ResourceUnavailableError: errorStatus, errorIndex = 'resourceUnavailable', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.CommitFailedError: errorStatus, errorIndex = 'commitFailed', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.UndoFailedError: errorStatus, errorIndex = 'undoFailed', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.AuthorizationError: errorStatus, errorIndex = 'authorizationError', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.NotWritableError: errorStatus, errorIndex = 'notWritable', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.InconsistentNameError: errorStatus, errorIndex = 'inconsistentName', sys.exc_info()[1]['idx'] + 1 + except pysnmp.smi.error.SmiError: - errorStatus, errorIndex = 'genErr', len(varBinds) and 1 or 0 + errorStatus, errorIndex = 'genErr', len(varBinds) and 1 + except pysnmp.error.PySnmpError: self.releaseStateInformation(stateReference) return + else: # successful request processor must release state info return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysnmp-4.4.8/pysnmp/proto/rfc1905.py new/pysnmp-4.4.9/pysnmp/proto/rfc1905.py --- old/pysnmp-4.4.8/pysnmp/proto/rfc1905.py 2018-12-30 14:21:41.000000000 +0100 +++ new/pysnmp-4.4.9/pysnmp/proto/rfc1905.py 2019-02-09 16:02:16.000000000 +0100 @@ -84,12 +84,13 @@ errorStatus = univ.Integer( - namedValues=namedval.NamedValues(('noError', 0), ('tooBig', 1), ('noSuchName', 2), ('badValue', 3), ('readOnly', 4), - ('genErr', 5), ('noAccess', 6), ('wrongType', 7), ('wrongLength', 8), - ('wrongEncoding', 9), ('wrongValue', 10), ('noCreation', 11), - ('inconsistentValue', 12), ('resourceUnavailable', 13), ('commitFailed', 14), - ('undoFailed', 15), ('authorizationError', 16), ('notWritable', 17), - ('inconsistentName', 18)) + namedValues=namedval.NamedValues( + ('noError', 0), ('tooBig', 1), ('noSuchName', 2), ('badValue', 3), ('readOnly', 4), + ('genErr', 5), ('noAccess', 6), ('wrongType', 7), ('wrongLength', 8), + ('wrongEncoding', 9), ('wrongValue', 10), ('noCreation', 11), + ('inconsistentValue', 12), ('resourceUnavailable', 13), ('commitFailed', 14), + ('undoFailed', 15), ('authorizationError', 16), ('notWritable', 17), + ('inconsistentName', 18)) ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysnmp-4.4.8/pysnmp/smi/builder.py new/pysnmp-4.4.9/pysnmp/smi/builder.py --- old/pysnmp-4.4.8/pysnmp/smi/builder.py 2018-12-30 14:21:41.000000000 +0100 +++ new/pysnmp-4.4.9/pysnmp/smi/builder.py 2019-02-09 16:02:16.000000000 +0100 @@ -44,14 +44,14 @@ return '%s(%r)' % (self.__class__.__name__, self._srcName) def _uniqNames(self, files): - u = {} + u = set() for f in files: - if f[:9] == '__init__.': + if f.startswith('__init__.'): continue for typ in (imp.PY_SOURCE, imp.PY_COMPILED): for sfx, sfxLen, mode in self.__sfx[typ]: if f[-sfxLen:] == sfx: - u[f[:-sfxLen]] = None + u.add(f[:-sfxLen]) return tuple(u) # MibSource API follows @@ -201,7 +201,8 @@ return self.__loader.get_data(p), p except Exception: # ZIP code seems to return all kinds of errors - raise IOError(ENOENT, 'No such file in ZIP archive: %s' % sys.exc_info()[1], p) + why = sys.exc_info() + raise IOError(ENOENT, 'File or ZIP archive %s access error: %s' % (p, why[1])) class DirMibSource(__AbstractMibSource): @@ -213,8 +214,9 @@ try: return self._uniqNames(os.listdir(self._srcName)) except OSError: + why = sys.exc_info() debug.logger & debug.flagBld and debug.logger( - 'listdir() failed for %s: %s' % (self._srcName, sys.exc_info()[1])) + 'listdir() failed for %s: %s' % (self._srcName, why[1])) return () def _getTimestamp(self, f): @@ -225,6 +227,7 @@ raise IOError(ENOENT, 'No such file: %s' % sys.exc_info()[1], p) def _getData(self, f, mode): + p = os.path.join(self._srcName, '*') try: if f in os.listdir(self._srcName): # make FS case-sensitive p = os.path.join(self._srcName, f) @@ -234,12 +237,13 @@ return data, p except (IOError, OSError): - why = sys.exc_info()[1] - if why.errno != ENOENT and ENOENT != -1: - raise error.MibLoadError('MIB file %s access error: %s' % (p, why)) + why = sys.exc_info() + msg = 'File or directory %s access error: %s' % (p, why[1]) - raise IOError(ENOENT, 'No such file: %s' % sys.exc_info()[1], f) + else: + msg = 'No such file or directory: %s' % p + raise IOError(ENOENT, msg) class MibBuilder(object): defaultCoreMibs = os.pathsep.join( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pysnmp-4.4.8/pysnmp/smi/error.py new/pysnmp-4.4.9/pysnmp/smi/error.py --- old/pysnmp-4.4.8/pysnmp/smi/error.py 2018-12-30 14:21:41.000000000 +0100 +++ new/pysnmp-4.4.9/pysnmp/smi/error.py 2019-02-09 16:02:16.000000000 +0100 @@ -43,7 +43,24 @@ self.__outArgs.update(d) -# Aligned with SNMPv2 PDU error-status +# Aligned with SNMPv2 PDU error-status values + +class TooBigError(MibOperationError): + pass + + +class NoSuchNameError(MibOperationError): + pass + + +class BadValueError(MibOperationError): + pass + + +class ReadOnlyError(MibOperationError): + pass + + class GenError(MibOperationError): pass @@ -100,20 +117,22 @@ pass -# Aligned with SNMPv2 Var-Bind exceptions -class NoSuchObjectError(MibOperationError): +# Aligned with SNMPv2 PDU exceptions or error-status values + +class NoSuchObjectError(NoSuchNameError): pass -class NoSuchInstanceError(MibOperationError): +class NoSuchInstanceError(NoSuchNameError): pass -class EndOfMibViewError(MibOperationError): +class EndOfMibViewError(NoSuchNameError): pass -# Row management +# SNMP table management exceptions + class TableRowManagement(MibOperationError): pass
participants (1)
-
root