This file is indexed.

/usr/share/pyshared/ControlAula/Plugins/DownloadFiles.py is in ltsp-controlaula 1.8.0-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
##############################################################################
# -*- coding: utf-8 -*-
# Project:     Controlaula
# Module:     DownloadFiles.py
# Purpose:     Module to download files from the teacher
# Language:    Python 2.5
# Date:        9-Mar-20010.
# Ver.:        10-Mar-2010.
# Copyright:    2009-2010 - José L. Redrejo Rodríguez       <jredrejo @nospam@ debian.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# 
##############################################################################
from twisted.web import client
from twisted.internet.defer import Deferred,DeferredList
from twisted.internet import reactor
from ControlAula.Utils import MyUtils  
    
class DownloadQueue(object):
    #maximum simultaneous downloads:
    SIZE = 50

    def __init__(self):
        self.requests = [] # queued requests
        self.deferreds = [] # waiting requests
    
    def addRequest(self, uri, file,exitfunc):
        self.exitfunc=exitfunc
        if len(self.deferreds) >= self.SIZE:
            # wait for completion of all previous requests
            DeferredList(self.deferreds
            ).addCallback(self._callback)
            self.deferreds = []
            
            # queue the request
            deferred = Deferred()
            self.requests.append((uri, file,deferred))
            
            return deferred
        else:
            # execute the request now
            #deferred = downloadPage(url, file)
            host, port, url = MyUtils.parse(uri)
            f = client.HTTPDownloader(uri, file)
            f.deferred.addCallbacks(callback=self.exitfunc,
                                callbackArgs=(file,) )
                    
            self.deferreds.append(f.deferred)
            reactor.connectTCP(host, port, f)
            
            return f.deferred
    
    def _callback(self):
        if len(self.requests) >self.SIZE:
            queue = self.requests[:self.SIZE]
            self.requests = self.requests[self.SIZE:]
        else:
            queue = self.requests[:]
            self.requests = []
        
        # execute the requests
        for (uri,file,  deferredHelper) in queue:
            
            host, port, url = MyUtils.parse(uri)
            f = client.HTTPDownloader(uri, file)
            f.deferred.addCallbacks(callback=self.exitfunc,    callbackArgs=(file,))
                    
            self.deferreds.append(f.deferred)
            reactor.connectTCP(host, port, f)            
                    
            f.deferred.chainDeferred(deferredHelper)