30
30
# See the documentation in lib/fileservice for details.
32
35
import fileservice_lib
37
import common.interpret
39
# handle_with_trampoline controls the way in which fileservice_lib is invoked.
40
# If False, it will simply be called directly by this handler.
41
# If True, the request will get marshalled into a CGI environment and the
42
# trampoline will invoke scripts/fileservices within the user's jail (SetUID'd
43
# to them). This script will then wrap the CGI environment in a replica of the
44
# original environment and handle it that way.
45
# This is a lot of overhead but it's the only way to properly ensure we are
46
# acting "as" that user and therefore we don't run into permissions problems.
47
# If set to True, it will be a lot more efficient, but there will be
48
# permissions issues unless all user's files are owned by the web server user.
49
HANDLE_WITH_TRAMPOLINE = False
51
fileservice_path = "/opt/ivle/scripts/fileservice" # Within jail
35
54
"""Handler for the File Services application."""
36
fileservice_lib.handle(req)
55
if not HANDLE_WITH_TRAMPOLINE:
56
fileservice_lib.handle(req)
58
interp_object = common.interpret.interpreter_objects["cgi-python"]
59
user_jail_dir = os.path.join(conf.jail_base, req.username)
60
common.interpret.interpret_file(req, req.username, user_jail_dir,
61
fileservice_path, interp_object)