This file is indexed.

/usr/lib/python2.7/dist-packages/Pyro/ext/remote_nons.py is in pyro 1:3.14-5.

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
#############################################################################
#  
#	simple Pyro connection module, without requiring Pyro's NameServer
#	(adapted from John Wiegley's remote.py)
#
#	This is part of "Pyro" - Python Remote Objects
#	which is (c) Irmen de Jong - irmen@razorvine.net
#
#############################################################################

import signal
import sys
import time

import Pyro.errors
import Pyro.naming
import Pyro.core
import Pyro.util

true, false = 1, 0

verbose            = false
pyro_daemon        = None
client_initialized = false
server_initialized = false
daemon_objects     = []

from Pyro.protocol import ProtocolError


def get_server_object(objectName, hostname , portnum):
    global client_initialized

    # initialize Pyro -- Python Remote Objects
    if not client_initialized:
        Pyro.core.initClient(verbose)
        client_initialized = true


    if verbose:
        print 'Binding object %s' % objectName

    try:
        URI = 'PYROLOC://%s:%d/%s' % (hostname,portnum,objectName)
        if verbose:
            print 'URI:', URI

        return Pyro.core.getAttrProxyForURI(URI)

    except Pyro.core.PyroError, x:
        raise Pyro.core.PyroError("Couldn't bind object, Pyro says:", x)

def provide_server_object(obj, name = None, hostname = '', portnum = None):
    global server_initialized, pyro_daemon
    proxy_class = Pyro.core.DynamicProxyWithAttrs

    if not server_initialized:
        Pyro.core.initServer(verbose)
        server_initialized = true

    if pyro_daemon is None:
        pyro_daemon = Pyro.core.Daemon(host = hostname, port = portnum)


    if not isinstance(obj, Pyro.core.ObjBase):
        slave = Pyro.core.ObjBase()
        slave.delegateTo(obj)
        obj = slave

    URI = pyro_daemon.connect(obj, name)
    if verbose:
        print 'provide_server_object: URI = ', URI
    daemon_objects.append(obj)

    proxy = proxy_class(URI)

    return proxy

abort = false

def interrupt(*args):
	global abort
	abort = true

if hasattr(signal,'SIGINT'): signal.signal(signal.SIGINT, interrupt)
#if hasattr(signal,'SIGHUP'): signal.signal(signal.SIGHUP, interrupt)
#if hasattr(signal,'SIGQUIT'): signal.signal(signal.SIGQUIT, interrupt)

def handle_requests(wait_time = None, callback = None):
    global abort
    
    abort = false

    if pyro_daemon is None:
        raise Pyro.errors.PyroError("There is no daemon with which to handle requests")
        return

    if wait_time:
        start = time.time()

    while not abort:
        try:
            pyro_daemon.handleRequests(wait_time)
            if wait_time:
                now = time.time()
                if callback and now - start > wait_time:
                    callback()
                    start = now
                elif callback:
                    callback()

        except Exception, msg:
            if verbose:
                print "Error:", sys.exc_type, msg
            abort = true
        except:
            abort = true

    return abort