From 791755e0d6971e7e77cf8251b5f9cfde3bd71142 Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Tue, 18 Jul 2006 15:00:47 +0000 Subject: [PATCH] Merged V1.3 to HEAD (3005:3013) svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3005 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3013 . git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3336 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/filesys/ftp/FTPDataSession.java | 4 ++ .../alfresco/filesys/ftp/FTPSrvSession.java | 52 +++++++++++++++++-- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/source/java/org/alfresco/filesys/ftp/FTPDataSession.java b/source/java/org/alfresco/filesys/ftp/FTPDataSession.java index c502942ef5..407b5cbc0f 100644 --- a/source/java/org/alfresco/filesys/ftp/FTPDataSession.java +++ b/source/java/org/alfresco/filesys/ftp/FTPDataSession.java @@ -849,6 +849,10 @@ public class FTPDataSession extends SrvSession implements Runnable disk.closeFile(this, tree, netFile); netFile = null; + // Commit the transaction now before notifying the client that the transfer is finished + + endTransaction(); + // Indicate that the file has been received sendFTPResponse(226, "Closing data connection"); diff --git a/source/java/org/alfresco/filesys/ftp/FTPSrvSession.java b/source/java/org/alfresco/filesys/ftp/FTPSrvSession.java index b47c2fb724..dcdb3b92d3 100644 --- a/source/java/org/alfresco/filesys/ftp/FTPSrvSession.java +++ b/source/java/org/alfresco/filesys/ftp/FTPSrvSession.java @@ -693,6 +693,25 @@ public class FTPSrvSession extends SrvSession implements Runnable } } + /** + * Send an FTP command response + * + * @param msg String + * @exception IOException + */ + protected final void sendFTPResponse(String msg) throws IOException + { + + // Output the FTP response + + if (m_out != null) + { + m_out.write(msg); + m_out.write(CRLF); + m_out.flush(); + } + } + /** * Process a user command * @@ -2623,7 +2642,6 @@ public class FTPSrvSession extends SrvSession implements Runnable DiskInterface disk = null; TreeConnection tree = null; - NetworkFile netFile = null; try { @@ -2742,7 +2760,6 @@ public class FTPSrvSession extends SrvSession implements Runnable DiskInterface disk = null; TreeConnection tree = null; - NetworkFile netFile = null; try { @@ -2824,6 +2841,29 @@ public class FTPSrvSession extends SrvSession implements Runnable sendFTPResponse(550, "Not implemented yet"); } + /** + * Process a features command + * + * @param req FTPRequest + * @exception IOException + */ + protected final void procFeatures(FTPRequest req) throws IOException + { + // Check if the user is logged in + + if (isLoggedOn() == false) + { + sendFTPResponse(500, ""); + return; + } + + // Send back the list of features supported by this FTP server + + sendFTPResponse( 211, "Features"); + sendFTPResponse( "SIZE"); + sendFTPResponse( 211, "End"); + } + /** * Process a file size command * @@ -2854,7 +2894,7 @@ public class FTPSrvSession extends SrvSession implements Runnable FTPPath ftpPath = generatePathForRequest(req, true); if (ftpPath == null) { - sendFTPResponse(500, "Invalid path"); + sendFTPResponse(550, "Invalid path"); return; } @@ -3560,6 +3600,12 @@ public class FTPSrvSession extends SrvSession implements Runnable procAbort(ftpReq); break; + // Return the list of features that this server supports + + case FTPCommand.Feat: + procFeatures(ftpReq); + break; + // Unknown/unimplemented command default: