This file is indexed.

/usr/lib/python2.7/dist-packages/framework/objectquery.py is in fso-frameworkd 0.10.1-3.

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
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
freesmartphone.org: Framework Support Object

(C) 2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
(C) 2008 Jan 'Shoragan' Lübbe <jluebbe@lasnet.de>
(C) 2008 Openmoko, Inc.

GPLv2 or later
"""

__version__ = "0.6.1"

try:
    from .__version__ import version
except ImportError:
    version = "inline"

from .introspection import process_introspection_data
from .config import DBUS_INTERFACE_PREFIX
from framework.patterns import tasklet, dbuscache

import gobject
import dbus, dbus.service

import os, sys, logging, logging.handlers
logger = logging # is this ok or do we need a formal logger for this module as well?

loggingmap = { \
    "DEBUG": logging.DEBUG,
    "INFO": logging.INFO,
    "WARNING": logging.WARNING,
    "ERROR": logging.ERROR,
    "CRITICAL": logging.CRITICAL,
    }

formatter = logging.Formatter('%(asctime)s %(name)-12s: %(levelname)-8s %(message)s')

#----------------------------------------------------------------------------#
class InvalidLogger( dbus.DBusException ):
#----------------------------------------------------------------------------#
    _dbus_error_name = "org.freesmartphone.Framework.InvalidLogger"

#----------------------------------------------------------------------------#
class InvalidLevel( dbus.DBusException ):
#----------------------------------------------------------------------------#
    _dbus_error_name = "org.freesmartphone.Framework.InvalidLevel"

#----------------------------------------------------------------------------#
class InvalidTarget( dbus.DBusException ):
#----------------------------------------------------------------------------#
    _dbus_error_name = "org.freesmartphone.Framework.InvalidTarget"

#----------------------------------------------------------------------------#
class Framework( dbus.service.Object ):
#----------------------------------------------------------------------------#
    """A D-Bus Object implementing org.freesmartphone.Framework"""
    DBUS_INTERFACE_FRAMEWORK = DBUS_INTERFACE_PREFIX + ".Framework"

    InterfaceCache = {}

    def __init__( self, bus, controller ):
        self.interface = self.DBUS_INTERFACE_FRAMEWORK
        self.path = "/org/freesmartphone/Framework"
        self.bus = bus
        dbus.service.Object.__init__( self, bus, self.path )
        self.controller = controller

    def _getInterfaceForObject( self, object, interface ):
        return dbuscache.dbusInterfaceForObjectWithInterface(
            "org.freesmartphone.frameworkd",
            object,
            interface )

    def _shutdownFramework( self ):
        self.controller.shutdown()
        return False

    #
    # dbus methods
    #
    @dbus.service.method( DBUS_INTERFACE_FRAMEWORK, "", "as" )
    def ListDebugLoggers( self ):
        """
        List available debug loggers.
        """
        return logging.root.manager.loggerDict.keys()

    @dbus.service.method( DBUS_INTERFACE_FRAMEWORK, "", "ss" )
    def GetDebugDestination( self ):
        try:
            handler = logging.root.handlers[0]
        except IndexError:
            handler = logging.StreamHandler()

        if isinstance( handler, logging.StreamHandler ):
            return ( "stderr", "" )
        elif isinstance( handler, logging.handlers.SysLogHandler ):
            return ( "syslog", "" )
        elif isinstance( handler, logging.FileHandler ):
            return ( "file", handler.stream.name )
        else:
            return ( "unknown", "" )

    @dbus.service.method( DBUS_INTERFACE_FRAMEWORK, "ss", "" )
    def SetDebugDestination( self, category, destination ):
        """
        Set the debug destination of logger.
        """
        if category == "stderr":
            handler = logging.StreamHandler()
        elif category == "syslog":
            handler = logging.handlers.SysLogHandler( address = "/dev/log" )
        elif category == "file" and destination != "":
            handler = logging.FileHandler( destination )
        else:
            raise InvalidHandler( "available handlers are: stderr, syslog, file" )

        handler.setFormatter( formatter )
        # yank existing handlers before adding new one
        for h in logging.root.handlers:
            logging.root.removeHandler( h )
        logging.root.addHandler( handler )

    @dbus.service.method( DBUS_INTERFACE_FRAMEWORK, "s", "s" )
    def GetDebugLevel( self, logger ):
        """
        Get the debug level of logger.
        """
        try:
            logger = logging.root.manager.loggerDict[logger]
        except KeyError:
            raise InvalidLogger( "available loggers are: %s" % logging.root.manager.loggerDict.keys() )
        else:
            return logging.getLevelName( logger.level )

    @dbus.service.method( DBUS_INTERFACE_FRAMEWORK, "ss", "" )
    def SetDebugLevel( self, logger, levelname ):
        """
        Set the debug level of logger to levelname.
        """
        try:
            level = loggingmap[levelname]
        except KeyError:
            raise InvalidLevel( "available levels are: %s" % loggingmap.keys() )
        else:
            if logger != "*":
                try:
                    logger = logging.root.manager.loggerDict[logger]
                except KeyError:
                    raise InvalidLogger( "available loggers are: %s" % logging.root.manager.loggerDict.keys() )
                else:
                    logger.setLevel( level )
            else:
                for logger in logging.root.manager.loggerDict.items():
                    logger.setLevel( level )

    @dbus.service.method( DBUS_INTERFACE_FRAMEWORK, "", "as" )
    def ListSubsystems( self ):
        return self.controller.subsystems().keys()

    @dbus.service.method( DBUS_INTERFACE_FRAMEWORK, "s", "as" )
    def ListObjectsInSubsystem( self, subsystem ):
        raise dbus.DBusException( "not yet implemented" )

    @dbus.service.method( DBUS_INTERFACE_FRAMEWORK, "", "" )
    def Shutdown( self ):
        gobject.idle_add( self._shutdownFramework )

    @dbus.service.method( DBUS_INTERFACE_FRAMEWORK, "", "s" )
    def GetVersion( self ):
        return version

#----------------------------------------------------------------------------#
def factory( prefix, controller ):
#----------------------------------------------------------------------------#
    return [ Framework( controller.bus, controller ) ]

#----------------------------------------------------------------------------#
if __name__ == "__main__":
#----------------------------------------------------------------------------#
    import dbus
    bus = dbus.SystemBus()

    query = bus.get_object( "org.freesmartphone.frameworkd", "/org/freesmartphone/Framework" )
    objects = query.ListObjectsByInterface( '*',  dbus_interface="org.freesmartphone.Framework" )

    phone = bus.get_object( "org.freesmartphone.ogsmd", "/org/freesmartphone/GSM/Device" )