Changeset 1141 for TI05-delivery/trunk/lib/python/delivery/server.py
- Timestamp:
- 08/06/06 12:51:22 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TI05-delivery/trunk/lib/python/delivery/server.py
r1133 r1141 7 7 import bbftpd 8 8 9 def start(authHandler ):9 def start(authHandler, args): 10 10 """Start the bbftp server. 11 11 12 12 The server performs a fork() during initialisation, the child process remains in 13 13 the server's main loop and the parent returns from this function. The server process 14 calls authHandler () on each connection to do authentication/authorisation.14 calls authHandler.authorise() on each connection to do authentication/authorisation. 15 15 16 16 @note: because the server process forks, authHandler will not see any changes to the python 17 17 interpreter following the call to start(). 18 18 19 @param authHandler: an instance of AuthHandler. 20 @param args: a list of command line arguments. 19 21 @return: the PID of the server process. 20 22 """ 21 23 22 bbftpd.run(authHandler)24 return bbftpd.run(authHandler, args) 23 25 24 26 … … 30 32 """ 31 33 32 def __call__(self):33 """Entry point called by the server to do authorisation.34 35 This function simply calls the authorise() method. See authorise() for details.36 """37 return self.authorise()38 39 34 def send(self, buffer): 40 35 """Send a message to the client. … … 70 65 class AuthzHandler(object): 71 66 """Abstract base class for implementing authorisation. 67 68 @ivar username the client's username 72 69 """ 73 70 … … 92 89 raise NotImplementedError 93 90 94 def authzS end(self, path):95 """Authorise a s endrequest.91 def authzStore(self, path): 92 """Authorise a store request. 96 93 97 94 @param path: the destination file. … … 99 96 """ 100 97 98 raise NotImplementedError 99 100 def _raiseNoUsername(self): 101 raise ValueError, "No username has been set" 102 username = property(_raiseNoUsername) 101 103 102 104 #-------------------------------------------------------------------------------------------------------------- 103 105 104 106 class BasicClientAuthHandler(AuthHandler): … … 124 126 return msg 125 127 128 129 130 class LiberalAuthzHandler(AuthzHandler): 131 """Allow everything. 132 """ 133 134 username = None 135 136 def __init__(self, username): 137 self.username = username 138 139 def authzControl(self, m, t, p): 140 return 0; 141 142 def authzRetr(self, p): 143 return 0; 144 145 def authzStore(self, p): 146 return 0; 147
Note: See TracChangeset
for help on using the changeset viewer.