This file is indexed.

/usr/lib/gdesklets/config/ConfigManager.py is in gdesklets 0.36.1-7.

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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from StateSaver import StateSaver
from utils.Observable import Observable
import utils


class _ConfigManager(Observable):
    """
    This class acts as a compatibility adaptor for deprecated sensors and can
    be removed as soon as support for sensors is being dropped.
    """

    UNDEF = "-- undef --"

    OBS_UPDATE = 1
    

    def __init__(self):

        self.__db = StateSaver("sensors")

        # hashtable for config change handlers: path -> handler
        self.__handlers = {}

        self.add_observer(self.__on_observe_backend)



    def __on_observe_backend(self, src, cmd, *args):

        if (cmd == src.OBS_UPDATE):
            path, value = args

            parts = path.split(".")
            for i in range(len(parts)):
                handler = self.__handlers.get(tuple(parts[:i + 1]))
            
                if (handler):
                    handler(parts, value)
                    break
            #end for



    def watch(self, *args):

        """Sets a callback handler for watching changes for the given
        configuration entry."""

        path = args[:-1]
        print "ADD WATCH", path
        handler = args[-1]
        self.__handlers[path] = handler



    def remove_watcher(self, *args):

        """Removes a watch callback handler."""

        try:
            path = args[:-1]
            del self.__handlers[path]
        except KeyError:
            pass


    def set(self, *args):

        path = ".".join(args[:-1])
        value = args[-1]

        self.__db.set_key(path, value)
        utils.request_call(self.update_observer, self.OBS_UPDATE, path, value)



    def get(self, *args):

        path = ".".join(args)
        value = self.__db.get_key(path, self.UNDEF)

        return value




_singleton = _ConfigManager()
def ConfigManager(): return _singleton