File: fs_chroot_module.py

package info (click to toggle)
pyftpd 0.8.4.3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 528 kB
  • ctags: 470
  • sloc: python: 2,802; sh: 80; makefile: 43
file content (32 lines) | stat: -rw-r--r-- 689 bytes parent folder | download | duplicates (5)
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
from fs_chroot_config import *

from utils import myfnmatch
import os

exec("from "+slave_fs+" import *")

slaveFileObject = FileObject
slaveFileSystem = FileSystem


class FileObject(slaveFileObject):
    pass
    

class FileSystem(slaveFileSystem):

    def __init__(self, session):
        self.slavefs = slaveFileSystem(session)
        global chrootdir
        self.chrootdir = ""
        for i in chrootlist:
            if myfnmatch(session.user, i[0]):
                self.chrootdir = i[1]

    def v2fs(self, f):
        r = self.slavefs.v2fs(self.chrootdir+f)
        return r

    def readlink(self, d):
        return "" # because the link points to real file.. ugh