This file is indexed.

/usr/share/pyshared/libsmbios_c/_common.py is in python-libsmbios 2.2.28-0ubuntu2.

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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# vim:tw=0:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:

  #############################################################################
  #
  # Copyright (c) 2005 Dell Computer Corporation
  # Dual Licenced under GNU GPL and OSL
  #
  #############################################################################
"""
_common:
    
"""

# imports (alphabetical)
import exceptions
import ctypes

from trace_decorator import decorate, traceLog, getLog

__all__ = ["freeLibStringFN", "errorOnZeroFN", "errorOnNegativeFN", "errorOnNullPtrFN" ]

class Exception(exceptions.Exception): pass

def _doExc(exception_fn, r, f, a, msg):
    if exception_fn is not None:
        raise exception_fn(r, f, a)
    else:
        raise Exception( msg )

def freeLibStringFN(free_fn, exception_fn=None):
    decorate(traceLog())
    def _freeLibStringFN(result, func, args):
        getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
        pystr = ctypes.cast(result, ctypes.c_char_p).value
        if pystr is None:
            pystr = ""
            #_doExc(exception_fn, result, func, args, _("null string returned") )

        free_fn(result)
        return pystr
    return _freeLibStringFN

def errorOnNullPtrFN(exception_fn=None):
    decorate(traceLog())
    def _errorOnNullPtrFN(result, func, args):
        getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
        if not bool(result): # check for null pointer
            _doExc(exception_fn, result, func, args, _("null pointer returned") )
        return result
    return _errorOnNullPtrFN

def errorOnZeroFN(exception_fn=None):
    decorate(traceLog())
    def _errorOnZeroFN(result, func, args):
        getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
        if result is None or result == 0:
            _doExc(exception_fn, result, func, args, _("function returned error value of zero") )
        return result
    return _errorOnZeroFN
 
def errorOnNegativeFN(exception_fn=None):
    decorate(traceLog())
    def _errorOnNegativeFN(result, func, args):
        getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
        if result is None or result < 0:
            _doExc(exception_fn, result, func, args, _("function returned negative error code") )
        return result
    return _errorOnNegativeFN