/usr/share/pyshared/pysnmp/proto/secmod/cache.py is in python-pysnmp4 4.2.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | from pysnmp import nextid
from pysnmp.proto import error
class Cache:
__stateReference = nextid.Integer(0xffffff)
def __init__(self):
self.__cacheEntries = {}
def push(self, **securityData):
stateReference = self.__stateReference()
self.__cacheEntries[stateReference] = securityData
return stateReference
def pop(self, stateReference):
if stateReference in self.__cacheEntries:
securityData = self.__cacheEntries[stateReference]
else:
raise error.ProtocolError(
'Cache miss for stateReference=%s at %s' %
(stateReference, self)
)
del self.__cacheEntries[stateReference]
return securityData
|