This file is indexed.

/usr/share/doc/pyro/examples/filetransfer/server.py is in pyro-examples 1:3.14-1.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
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
#!/usr/bin/env python

import Pyro.core
import Pyro.naming
import os,sys

CHUNK_SIZE = 500000

#
#	File server.
#	Serves files only from a single directory.
#	Supports two transfer methods:
#	- read and send whole file in once call (uses much memory!, but is fastest)
#	- read and send file in chunks (uses only <chunksize> bytes of memory, is slightly slower.)
#
#
#	NOTE: this is just an example to show how you _could_ send
#	large streams of data with Pyro (by transferring it in chunks).
#	THIS CODE CAN NOT COPE WITH MULTIPLE TRANSFERS AT THE SAME TIME!
#	(because the file server is statefull and only knows about
#	a single file transfer that is in progress). Also, no measures
#	are taken to protect the file transfer from other clients that
#	connect to the server and 'hijack' the download by calling
#	retrieveNextChunk.
#

class FileServer(Pyro.core.ObjBase):
	def __init__(self, rootdir):
		Pyro.core.ObjBase.__init__(self)
		self.rootdir=os.path.abspath(rootdir)
		print "File server serving from",self.rootdir
		
	def listdir(self):
		dirs=[]
		files=[]
		for a in os.listdir(self.rootdir):
			if os.path.isdir(os.path.join(self.rootdir,a)):
				dirs.append(a)
			else:
				files.append(a)
		return files    # forget about the directories.
	
	def retrieveAtOnce(self, file):
		return open(os.path.join(self.rootdir,file),'rb').read()
		
	def openFile(self,file):
		if hasattr(self.getLocalStorage(), "openfile"):
			raise IOError("can only read one file at a time, close previous file first")
		file=os.path.join(self.rootdir,file)
		self.getLocalStorage().openfile=open(file,'rb')
		return os.path.getsize(file)
	def retrieveNextChunk(self):
		chunk= self.getLocalStorage().openfile.read(CHUNK_SIZE)
		if chunk:
			return chunk
		self.getLocalStorage().openfile.close()
		return ''
	def closeFile(self):
		self.getLocalStorage().openfile.close()
		del self.getLocalStorage().openfile



def main(args):
	Pyro.core.initServer()
	daemon=Pyro.core.Daemon()
	daemon.useNameServer(Pyro.naming.NameServerLocator().getNS())
	uri=daemon.connect(FileServer(args[1]), "fileserver")
	print "File server is running."
	daemon.requestLoop()


if __name__=="__main__":
	if len(sys.argv)!=2:
		print "Please give the file server root path as an argument to this script."
	else:
		main(sys.argv)