public class FTPSrvSession extends SrvSession implements Runnable
Modifier and Type | Field and Description |
---|---|
protected static String[] |
_factNames |
protected static String |
CRLF |
static int |
DBG_DATAPORT |
static int |
DBG_DIRECTORY |
static int |
DBG_DUMPDATA |
static int |
DBG_ERROR |
static int |
DBG_FILE |
static int |
DBG_FILEIO |
static int |
DBG_INFO |
static int |
DBG_PKTTYPE |
static int |
DBG_RXDATA |
static int |
DBG_SEARCH |
static int |
DBG_SSL |
static int |
DBG_STATE |
static int |
DBG_TIMING |
static int |
DBG_TXDATA |
protected static int |
DefCommandBufSize |
static boolean |
FeatureAUTH |
static boolean |
FeatureMFMT |
static boolean |
FeatureMLST |
static boolean |
FeatureSIZE |
static boolean |
FeatureUTF8 |
protected static char |
LIST_OPTION_HIDDEN |
protected static String |
LIST_OPTION_PREFIX |
protected static int |
MaxCommandBufSize |
protected static int |
MDTM_DATETIME_MINLEN |
protected static int |
MLSD_BUFFER_SIZE |
protected static int |
MLST_CREATE |
protected static int |
MLST_DEFAULT |
protected static int |
MLST_MEDIATYPE |
protected static int |
MLST_MODIFY |
protected static int |
MLST_PERM |
protected static int |
MLST_SIZE |
protected static int |
MLST_TYPE |
protected static int |
MLST_UNIQUE |
protected static String |
ProtLevelClear |
protected static String |
ProtLevels |
protected static int |
TypeIPv4 |
protected static int |
TypeIPv6 |
Constructor and Description |
---|
FTPSrvSession(Socket sock,
FTPServer srv)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
clearCommandSocket()
Clear the command socket of pending data
|
void |
closeSession()
Close the FTP session, and associated data socket if active
|
protected String |
convertToFTPSeperators(String path)
Convert a path string from share path seperators to FTP path seperators
|
protected DiskSharedDevice |
findShare(String name)
Find the required disk shared device
|
protected void |
generateMlstString(FileInfo finfo,
int mlstFlags,
StringBuffer buf,
boolean isMlsd)
Generate a machine listing string for the specified file/folder information
|
protected FTPPath |
generatePathForRequest(FTPRequest req,
boolean filePath)
Get the path details for the current request
|
protected FTPPath |
generatePathForRequest(FTPRequest req,
boolean filePath,
boolean checkExists)
Get the path details for the current request
|
String |
getCurrentWorkingDirectory()
Return the current working directory
|
FTPServer |
getFTPServer()
Return the server that this session is associated with.
|
InetAddress |
getRemoteAddress()
Return the client network address
|
protected SharedDeviceList |
getShareList()
Get the list of filtered shares that are available to this session
|
protected int |
getSSLCommand(byte[] buf,
int len)
Get the next command data on an SSL/TLS encrypted connection
|
protected TreeConnection |
getTreeConnection(SharedDevice share)
Get a tree connection for the specified shared device.
|
boolean |
hasCurrentWorkingDirectory()
Check if there is a current working directory
|
protected boolean |
isSecureSession()
Check if the session is in SSL/TLS mode
|
boolean |
isUTF8Enabled()
Check if UTF-8 filenames are enabled
|
protected Vector<Object> |
listFilesForPath(FTPPath path,
boolean nameOnly,
boolean hidden)
Build a list of file name or file information objects for the specified server path
|
protected void |
procAbort(FTPRequest req)
Process an abort command.
|
protected void |
procAllocate(FTPRequest req)
Process an allocate command.
|
protected void |
procAuth(FTPRequest req)
Process an authentication command for SSL/TLS.
|
protected void |
procCdup(FTPRequest req)
Process a change directory up command
|
protected void |
procChangeWorkDir(FTPRequest req)
Process a change working directory command
|
protected void |
procClearCommandChannel(FTPRequest ftpReq)
Process a clear command channel command
|
protected void |
procCreateDirectory(FTPRequest req)
Process a create directory command
|
protected void |
procDataChannelProtection(FTPRequest req)
Process a data channel protection level command.
|
protected void |
procDeleteFile(FTPRequest req)
Process a delete file command
|
protected void |
procExtendedPassive(FTPRequest req)
Process an extended passive command
|
protected void |
procExtendedPort(FTPRequest req)
Process an extended port command
|
protected void |
procFeatures(FTPRequest req)
Process a server features request
|
protected void |
procFileSize(FTPRequest req)
Process a file size command
|
protected void |
procGetModifyDateTime(FTPRequest req)
Process a get modification date/time command
|
protected void |
procHelp(FTPRequest req)
Process a help command
|
protected void |
procList(FTPRequest req)
Process a long directory listing command
|
protected void |
procMachineListing(FTPRequest req)
Process a machine listing request, single folder
|
protected void |
procMachineListingContents(FTPRequest req)
Process a machine listing request, folder contents
|
protected void |
procMode(FTPRequest req)
Process a mode command.
|
protected void |
procModifyDateTime(FTPRequest req)
Process a modify date/time command
|
protected void |
procNList(FTPRequest req)
Process a short directory listing command
|
protected void |
procNoop(FTPRequest req)
Process a no-op command
|
protected void |
procOptions(FTPRequest req)
Process an options request
|
protected void |
procPassive(FTPRequest req)
Process a passive command
|
protected void |
procPassword(FTPRequest req)
Process a password command
|
protected void |
procPort(FTPRequest req)
Process a port command
|
protected void |
procPrintWorkDir(FTPRequest req)
Process a print working directory command
|
protected void |
procProtectedBufferSize(FTPRequest req)
Process a protected buffer size command.
|
protected void |
procQuit(FTPRequest req)
Process a quit command
|
protected void |
procRemoveDirectory(FTPRequest req)
Process a delete directory command
|
protected void |
procRenameFrom(FTPRequest req)
Process a rename from command
|
protected void |
procRenameTo(FTPRequest req)
Process a rename to command
|
protected void |
procRestart(FTPRequest req)
Process a restart command
|
protected void |
procReturnFile(FTPRequest req)
Process a return file command
|
protected void |
procServerStatus(FTPRequest req)
Process a server status command
|
protected void |
procSite(FTPRequest req)
Process a site specific command
|
protected void |
procStoreFile(FTPRequest req,
boolean append)
Process a store file command
|
protected void |
procStructure(FTPRequest req)
Process a structure command.
|
protected void |
procSystemStatus(FTPRequest req)
Process a system status command
|
protected void |
procType(FTPRequest req)
Process a type command
|
protected void |
procUser(FTPRequest req)
Process a user command
|
void |
run()
Start the FTP session in a seperate thread
|
protected void |
sendEncryptedFTPResponse(String msg)
Send an encrypted FTP response
|
protected void |
sendFTPNotLoggedOnResponse()
Return a not logged status
|
void |
sendFTPResponse(int stsCode,
String msg)
Send an FTP command response
|
void |
sendFTPResponse(String msg)
Send an FTP command response
|
void |
sendFTPResponse(StringBuffer msg)
Send an FTP command response
|
void |
sendUnencryptedFTPResponse(int stsCode,
String msg)
Send an unencrypted FTP command response
|
protected void |
setBinary(boolean bin)
Set the binary mode flag
|
void |
setRootPath(FTPPath rootPath)
Set the default path for the session
|
protected void |
setupSSLEngine(String engineTyp)
Initialize the SSL engine when SSL mode is enabled on the command socket
|
boolean |
useCaseSensitiveSearch()
Indicate that FTP filesystem searches are case sensitive
|
addDynamicShare, clearTransaction, debugPrint, debugPrintln, debugPrintln, endTransaction, getAuthenticationContext, getClientInformation, getDriverState, getDynamicShareList, getLastIOTime, getNextPostProcessor, getProcessId, getProtocolName, getRemoteName, getServer, getSessionId, getTransactionObject, getUniqueId, hasAuthenticationContext, hasClientInformation, hasDebug, hasDynamicShares, hasPostProcessorRequests, hasProtocolName, hasRemoteName, hasTransaction, initializeTransactionObject, isLoggedOn, isPseudoFilesEnabled, isShutdown, setAuthenticationContext, setClientInformation, setDebug, setDebugPrefix, setDriverState, setLastIOTime, setLoggedOn, setProcessId, setProtocolName, setRemoteName, setSessionId, setShutdown, setTransaction, setTransaction, setUniqueId, toString
public static final int DBG_STATE
public static final int DBG_RXDATA
public static final int DBG_TXDATA
public static final int DBG_DUMPDATA
public static final int DBG_SEARCH
public static final int DBG_INFO
public static final int DBG_FILE
public static final int DBG_FILEIO
public static final int DBG_ERROR
public static final int DBG_PKTTYPE
public static final int DBG_TIMING
public static final int DBG_DATAPORT
public static final int DBG_DIRECTORY
public static final int DBG_SSL
public static final boolean FeatureUTF8
public static final boolean FeatureMFMT
public static final boolean FeatureSIZE
public static final boolean FeatureMLST
public static final boolean FeatureAUTH
protected static final String CRLF
protected static final String LIST_OPTION_PREFIX
protected static final char LIST_OPTION_HIDDEN
protected static final int MLST_SIZE
protected static final int MLST_MODIFY
protected static final int MLST_CREATE
protected static final int MLST_TYPE
protected static final int MLST_UNIQUE
protected static final int MLST_PERM
protected static final int MLST_MEDIATYPE
protected static final int MLST_DEFAULT
protected static final String[] _factNames
protected static final int MLSD_BUFFER_SIZE
protected static final int MDTM_DATETIME_MINLEN
protected static final int TypeIPv4
protected static final int TypeIPv6
protected static final String ProtLevels
protected static final String ProtLevelClear
protected static final int DefCommandBufSize
protected static final int MaxCommandBufSize
public final void closeSession()
closeSession
in class SrvSession
public final String getCurrentWorkingDirectory()
public final FTPServer getFTPServer()
public final InetAddress getRemoteAddress()
getRemoteAddress
in class SrvSession
public final boolean hasCurrentWorkingDirectory()
public final boolean isUTF8Enabled()
public final void setRootPath(FTPPath rootPath)
rootPath
- FTPPathprotected final FTPPath generatePathForRequest(FTPRequest req, boolean filePath)
req
- FTPRequestfilePath
- booleanprotected final FTPPath generatePathForRequest(FTPRequest req, boolean filePath, boolean checkExists)
req
- FTPRequestfilePath
- booleancheckExists
- booleanprotected final String convertToFTPSeperators(String path)
path
- Stringprotected final DiskSharedDevice findShare(String name)
name
- Stringprotected final void setBinary(boolean bin)
bin
- booleanpublic final void sendFTPResponse(int stsCode, String msg) throws IOException
stsCode
- intmsg
- StringIOException
public final void sendUnencryptedFTPResponse(int stsCode, String msg) throws IOException
stsCode
- intmsg
- StringIOException
public final void sendFTPResponse(StringBuffer msg) throws IOException
msg
- StringBufferIOException
public final void sendFTPResponse(String msg) throws IOException
msg
- StringIOException
protected final void sendEncryptedFTPResponse(String msg) throws IOException
msg
- StringIOException
protected final void procUser(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procPassword(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procPort(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procPassive(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procPrintWorkDir(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procChangeWorkDir(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procCdup(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procList(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procNList(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procSystemStatus(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procServerStatus(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procHelp(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procNoop(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procOptions(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procQuit(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procType(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procRestart(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procReturnFile(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procStoreFile(FTPRequest req, boolean append) throws IOException
req
- FTPRequestappend
- booleanIOException
protected final void procDeleteFile(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procRenameFrom(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procRenameTo(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procCreateDirectory(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procRemoveDirectory(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procMachineListing(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procMachineListingContents(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procGetModifyDateTime(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procModifyDateTime(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procFeatures(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procFileSize(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procSite(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procStructure(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procMode(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procAllocate(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procAbort(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procAuth(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procProtectedBufferSize(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procDataChannelProtection(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procClearCommandChannel(FTPRequest ftpReq) throws IOException
ftpReq
- FTPRequestIOException
protected final void procExtendedPort(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final void procExtendedPassive(FTPRequest req) throws IOException
req
- FTPRequestIOException
protected final Vector<Object> listFilesForPath(FTPPath path, boolean nameOnly, boolean hidden)
path
- FTPPathnameOnly
- booleanhidden
- booleanprotected final SharedDeviceList getShareList()
protected final TreeConnection getTreeConnection(SharedDevice share)
share
- SharedDeviceprotected void clearCommandSocket() throws IOException
IOException
protected final int getSSLCommand(byte[] buf, int len) throws SocketException, IOException
buf
- byte[]len
- intSocketException
IOException
protected final void setupSSLEngine(String engineTyp) throws IOException, NoSuchAlgorithmException, CertificateException, KeyStoreException, UnrecoverableKeyException, KeyManagementException
engineTyp
- StringIOException
NoSuchAlgorithmException
CertificateException
KeyStoreException
UnrecoverableKeyException
KeyManagementException
protected final boolean isSecureSession()
protected final void generateMlstString(FileInfo finfo, int mlstFlags, StringBuffer buf, boolean isMlsd)
finfo
- FileInfomlstFlags
- intbuf
- StringBufferisMlsd
- booleanprotected final void sendFTPNotLoggedOnResponse() throws IOException
IOException
public boolean useCaseSensitiveSearch()
useCaseSensitiveSearch
in class SrvSession
Copyright © 2005–2018 Alfresco Software. All rights reserved.