module documentation

An FTP protocol implementation

Interface IFinishableConsumer A Consumer for producers that finish.
Interface IFTPShell An abstraction of the shell commands used by the FTP protocol for a given user account.
Interface IReadFile A file out of which bytes may be read.
Interface IWriteFile A file into which bytes may be written.
Class ASCIIConsumerWrapper Undocumented
Class BaseFTPRealm Base class for simple FTP realms which provides an easy hook for specifying the home directory for each user.
Class DTP No class docstring; 0/4 instance variable, 0/1 class variable, 2/15 methods documented
Class DTPFactory Client factory for data transfer process protocols.
Class FileConsumer A consumer for FTP input that writes data to a file.
Class FTP Protocol Interpreter for the File Transfer Protocol
Class FTPAnonymousShell An anonymous implementation of IFTPShell
Class FTPClient FTPClient is a client implementation of the FTP protocol which exposes FTP commands as methods which return Deferreds.
Class FTPClientBasic Foundations of an FTP client.
Class FTPCommand Undocumented
Class FTPDataPortFactory Factory for data connections that use the PORT command
Class FTPFactory A factory for producing ftp protocol instances
Class FTPFileListProtocol Parser for standard FTP file listings
Class FTPOverflowProtocol FTP mini-protocol for when there are too many connections.
Class FTPRealm No summary
Class FTPShell An authenticated implementation of IFTPShell.
Class ProtocolWrapper Undocumented
Class SenderProtocol No class docstring; 0/2 instance variable, 2/8 methods documented
Class SystemFTPRealm SystemFTPRealm uses system user account information to decide what the home directory for a particular avatarId is.
Exception AnonUserDeniedError Raised when an anonymous user issues a command that will alter the filesystem
Exception AuthorizationError Raised when client authentication fails.
Exception BadCmdSequenceError Raised when a client sends a series of commands in an illogical sequence.
Exception BadResponse Undocumented
Exception CmdArgSyntaxError Raised when a command is called with wrong value or a wrong number of arguments.
Exception CmdNotImplementedError Raised when an unimplemented command is given to the server.
Exception CmdNotImplementedForArgError Raised when the handling of a parameter for a command is not implemented by the server.
Exception CmdSyntaxError Raised when a command syntax is wrong.
Exception CommandFailed Undocumented
Exception ConnectionLost Undocumented
Exception FileExistsError Raised when attempted to override an existing resource.
Exception FileNotFoundError Raised when trying to access a non existent file or directory.
Exception FTPCmdError Generic exception for FTP commands.
Exception FTPError Undocumented
Exception InvalidPath Internal exception used to signify an error during parsing a path.
Exception IsADirectoryError Raised when DELE is called on a path that is a directory.
Exception IsNotADirectoryError Raised when RMD is called on a path that isn't a directory.
Exception PermissionDeniedError Raised when access is attempted to a resource to which access is not allowed.
Exception PortConnectionError Undocumented
Exception UnexpectedData Undocumented
Exception UnexpectedResponse Undocumented
Function debugDeferred Undocumented
Function decodeHostPort Decode an FTP response specifying a host and port.
Function encodeHostPort Undocumented
Function errnoToFailure Map OSError and IOError to standard FTP errors.
Function parsePWDResponse Returns the path from a response to a PWD command.
Function toSegments Normalize a path, as represented by a list of strings each representing one segment of the path.
Constant ANON_USER_DENIED Undocumented
Constant AUTH_FAILURE Undocumented
Constant BAD_CMD_SEQ Undocumented
Constant CANT_OPEN_DATA_CNX Undocumented
Constant CLOSING_DATA_CNX Undocumented
Constant CMD_NOT_IMPLMNTD Undocumented
Constant CMD_NOT_IMPLMNTD_FOR_PARAM Undocumented
Constant CMD_NOT_IMPLMNTD_SUPERFLUOUS Undocumented
Constant CMD_OK Undocumented
Constant CNX_CLOSED_TXFR_ABORTED Undocumented
Constant DATA_CNX_ALREADY_OPEN_START_XFR Undocumented
Constant DATA_CNX_OPEN_NO_XFR_IN_PROGRESS Undocumented
Constant DIR_STATUS Undocumented
Constant ENTERING_EPSV_MODE Undocumented
Constant ENTERING_PASV_MODE Undocumented
Constant ENTERING_PORT_MODE Undocumented
Constant EXCEEDED_STORAGE_ALLOC Undocumented
Constant FEAT_OK Undocumented
Constant FILE_EXISTS Undocumented
Constant FILE_NOT_FOUND Undocumented
Constant FILE_STATUS Undocumented
Constant FILE_STATUS_OK_OPEN_DATA_CNX Undocumented
Constant FILENAME_NOT_ALLOWED Undocumented
Constant GOODBYE_MSG Undocumented
Constant GUEST_LOGGED_IN_PROCEED Undocumented
Constant GUEST_NAME_OK_NEED_EMAIL Undocumented
Constant HELP_MSG Undocumented
Constant IS_A_DIR Undocumented
Constant IS_NOT_A_DIR Undocumented
Constant MKD_REPLY Undocumented
Constant NAME_SYS_TYPE Undocumented
Constant NEED_ACCT_FOR_LOGIN Undocumented
Constant NEED_ACCT_FOR_STOR Undocumented
Constant NOT_LOGGED_IN Undocumented
Constant OPTS_NOT_IMPLEMENTED Undocumented
Constant PAGE_TYPE_UNK Undocumented
Constant PERMISSION_DENIED Undocumented
Constant PWD_REPLY Undocumented
Constant REQ_ACTN_ABRTD_FILE_UNAVAIL Undocumented
Constant REQ_ACTN_ABRTD_INSUFF_STORAGE Undocumented
Constant REQ_ACTN_ABRTD_LOCAL_ERR Undocumented
Constant REQ_ACTN_NOT_TAKEN Undocumented
Constant REQ_FILE_ACTN_COMPLETED_OK Undocumented
Constant REQ_FILE_ACTN_PENDING_FURTHER_INFO Undocumented
Constant RESPONSE Undocumented
Constant RESTART_MARKER_REPLY Undocumented
Constant SERVICE_READY_IN_N_MINUTES Undocumented
Constant SVC_CLOSING_CTRL_CNX Undocumented
Constant SVC_NOT_AVAIL_CLOSING_CTRL_CNX Undocumented
Constant SVC_READY_FOR_NEW_USER Undocumented
Constant SYNTAX_ERR Undocumented
Constant SYNTAX_ERR_IN_ARGS Undocumented
Constant SYS_STATUS_OR_HELP_REPLY Undocumented
Constant TOO_MANY_CONNECTIONS Undocumented
Constant TXFR_COMPLETE_OK Undocumented
Constant TYPE_SET_OK Undocumented
Constant USR_LOGGED_IN_PROCEED Undocumented
Constant USR_NAME_OK_NEED_PASS Undocumented
Constant WELCOME_MSG Undocumented
Class _FileReader Undocumented
Class _FileWriter Undocumented
Class _PassiveConnectionFactory Undocumented
Function _getgroups Return the primary and supplementary groups for the given UID.
Function _isGlobbingExpression Helper for checking if a FTPShell `segments` contains a wildcard Unix expression.
Function _testPermissions checks to see if uid has proper permissions to access path with mode
Function _unwrapFirstError Undocumented
Variable _months Undocumented
Variable _testTranslation Undocumented
def debugDeferred(self, *_): (source)

Undocumented

def decodeHostPort(line): (source)

Decode an FTP response specifying a host and port.

Returns
a 2-tuple of (host, port).
def encodeHostPort(host, port): (source)

Undocumented

def errnoToFailure(e, path): (source)

Map OSError and IOError to standard FTP errors.

def parsePWDResponse(response): (source)

Returns the path from a response to a PWD command.

Responses typically look like:

    257 "/home/andrew" is current directory.

For this example, I will return '/home/andrew'.

If I can't find the path, I return None.

def toSegments(cwd, path): (source)

Normalize a path, as represented by a list of strings each representing one segment of the path.

ANON_USER_DENIED: str = (source)

Undocumented

Value
'550.3'
AUTH_FAILURE: str = (source)

Undocumented

Value
'530.2'
BAD_CMD_SEQ: str = (source)

Undocumented

Value
'503'
CANT_OPEN_DATA_CNX: str = (source)

Undocumented

Value
'425'
CLOSING_DATA_CNX: str = (source)

Undocumented

Value
'226.1'
CMD_NOT_IMPLMNTD: str = (source)

Undocumented

Value
'502.1'
CMD_NOT_IMPLMNTD_FOR_PARAM: str = (source)

Undocumented

Value
'504'
CMD_NOT_IMPLMNTD_SUPERFLUOUS: str = (source)

Undocumented

Value
'202'

Undocumented

Value
'200.1'
CNX_CLOSED_TXFR_ABORTED: str = (source)

Undocumented

Value
'426'
DATA_CNX_ALREADY_OPEN_START_XFR: str = (source)

Undocumented

Value
'125'
DATA_CNX_OPEN_NO_XFR_IN_PROGRESS: str = (source)

Undocumented

Value
'225'
DIR_STATUS: str = (source)

Undocumented

Value
'212'
ENTERING_EPSV_MODE: str = (source)

Undocumented

Value
'229'
ENTERING_PASV_MODE: str = (source)

Undocumented

Value
'227'
ENTERING_PORT_MODE: str = (source)

Undocumented

Value
'200.3'
EXCEEDED_STORAGE_ALLOC: str = (source)

Undocumented

Value
'552'

Undocumented

Value
'211.2'
FILE_EXISTS: str = (source)

Undocumented

Value
'550.6'
FILE_NOT_FOUND: str = (source)

Undocumented

Value
'550.1'
FILE_STATUS: str = (source)

Undocumented

Value
'213'
FILE_STATUS_OK_OPEN_DATA_CNX: str = (source)

Undocumented

Value
'150'
FILENAME_NOT_ALLOWED: str = (source)

Undocumented

Value
'553'
GOODBYE_MSG: str = (source)

Undocumented

Value
'221.2'
GUEST_LOGGED_IN_PROCEED: str = (source)

Undocumented

Value
'230.2'
GUEST_NAME_OK_NEED_EMAIL: str = (source)

Undocumented

Value
'331.2'
HELP_MSG: str = (source)

Undocumented

Value
'214'
IS_A_DIR: str = (source)

Undocumented

Value
'550.7'
IS_NOT_A_DIR: str = (source)

Undocumented

Value
'550.4'
MKD_REPLY: str = (source)

Undocumented

Value
'257.2'
NAME_SYS_TYPE: str = (source)

Undocumented

Value
'215'
NEED_ACCT_FOR_LOGIN: str = (source)

Undocumented

Value
'332'
NEED_ACCT_FOR_STOR: str = (source)

Undocumented

Value
'532'
NOT_LOGGED_IN: str = (source)

Undocumented

Value
'530.1'
OPTS_NOT_IMPLEMENTED: str = (source)

Undocumented

Value
'502.2'
PAGE_TYPE_UNK: str = (source)

Undocumented

Value
'551'
PERMISSION_DENIED: str = (source)

Undocumented

Value
'550.2'
PWD_REPLY: str = (source)

Undocumented

Value
'257.1'
REQ_ACTN_ABRTD_FILE_UNAVAIL: str = (source)

Undocumented

Value
'450'
REQ_ACTN_ABRTD_INSUFF_STORAGE: str = (source)

Undocumented

Value
'452'
REQ_ACTN_ABRTD_LOCAL_ERR: str = (source)

Undocumented

Value
'451'
REQ_ACTN_NOT_TAKEN: str = (source)

Undocumented

Value
'550.5'
REQ_FILE_ACTN_COMPLETED_OK: str = (source)

Undocumented

Value
'250'
REQ_FILE_ACTN_PENDING_FURTHER_INFO: str = (source)

Undocumented

Value
'350'
RESPONSE = (source)

Undocumented

Value
{RESTART_MARKER_REPLY: '110 MARK yyyy-mmmm',
 SERVICE_READY_IN_N_MINUTES: '120 service ready in %s minutes',
 DATA_CNX_ALREADY_OPEN_START_XFR: '125 Data connection already open, starting tr
ansfer',
 FILE_STATUS_OK_OPEN_DATA_CNX: '150 File status okay; about to open data connect
ion.',
 CMD_OK: '200 Command OK',
...
RESTART_MARKER_REPLY: str = (source)

Undocumented

Value
'100'
SERVICE_READY_IN_N_MINUTES: str = (source)

Undocumented

Value
'120'
SVC_CLOSING_CTRL_CNX: str = (source)

Undocumented

Value
'221.1'
SVC_NOT_AVAIL_CLOSING_CTRL_CNX: str = (source)

Undocumented

Value
'421.1'
SVC_READY_FOR_NEW_USER: str = (source)

Undocumented

Value
'220.1'
SYNTAX_ERR: str = (source)

Undocumented

Value
'500'
SYNTAX_ERR_IN_ARGS: str = (source)

Undocumented

Value
'501'
SYS_STATUS_OR_HELP_REPLY: str = (source)

Undocumented

Value
'211.1'
TOO_MANY_CONNECTIONS: str = (source)

Undocumented

Value
'421.2'
TXFR_COMPLETE_OK: str = (source)

Undocumented

Value
'226.2'
TYPE_SET_OK: str = (source)

Undocumented

Value
'200.2'
USR_LOGGED_IN_PROCEED: str = (source)

Undocumented

Value
'230.1'
USR_NAME_OK_NEED_PASS: str = (source)

Undocumented

Value
'331.1'
WELCOME_MSG: str = (source)

Undocumented

Value
'220.2'
def _getgroups(uid): (source)

Return the primary and supplementary groups for the given UID.

Parameters
uid:intUndocumented
def _isGlobbingExpression(segments=None): (source)

Helper for checking if a FTPShell `segments` contains a wildcard Unix expression.

Only filename globbing is supported. This means that wildcards can only be presents in the last element of `segments`.

Parameters
segments:listList of path elements as used by the FTP server protocol.
Returns
BooleanTrue if `segments` contains a globbing expression.
def _testPermissions(uid, gid, spath, mode='r'): (source)

checks to see if uid has proper permissions to access path with mode

Parameters
uid:intnumeric user id
gid:intnumeric group id
spath:strthe path on the server to test
mode:str'r' or 'w' (read or write)
Returns
boolTrue if the given credentials have the specified form of access to the given path
def _unwrapFirstError(failure): (source)

Undocumented

Undocumented

_testTranslation = (source)

Undocumented