[
https://issues.apache.org/jira/browse/NET-354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13019368#comment-13019368
]
Erick Lichtas edited comment on NET-354 at 4/13/11 3:12 PM:
------------------------------------------------------------
Sample program CCCTester.java is attached. This program connects to an FTPS
server, sets the data channel protection level, runs the CCC command, and lists
the home directory. This program was run using jre 1.5.0_22 on windows. It is
using commons-net 2.2 with the patch provided in this jira case.
My tests were performed using a trial version of GlobalScapes EFT server with
CCC enabled. And below is the output of the sample program:
REPLY: 220 EFT Server Enterprise 6.1.0 Build 10.30.2009.48 * UNREGISTERED COPY *
COMMAND: USER test
REPLY: 331 Password required for test.
COMMAND: PASS **********
REPLY: 230-This is an * UNREGISTERED COPY * of GlobalSCAPE EFT Server.
230 Login OK. Proceed.
COMMAND: PBSZ 0
REPLY: 200 PBSZ Command OK. Protection buffer size set to 0.
COMMAND: PROT P
REPLY: 200 PROT Command OK. Using Private data connection
COMMAND: CCC
REPLY: 200 Clear Command Channel Successful.
COMMAND: SYST
org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed
without indication.
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:298)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:495)
at
org.apache.commons.net.ftp.FTPSClient.sendCommand(FTPSClient.java:486)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:537)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:586)
at org.apache.commons.net.ftp.FTP.syst(FTP.java:1504)
at
org.apache.commons.net.ftp.FTPClient.getSystemType(FTPClient.java:2074)
at
org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2511)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2276)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2322)
at test.ftps.CCCTester.test(CCCTester.java:42)
at test.ftps.CCCTester.main(CCCTester.java:101)
was (Author: elichtas):
Sample program to connect to an FTPS server, set the data channel
protection level, run the CCC command, and list the home directory.
> FTPSClient not properly supporting CCC and PROT P
> -------------------------------------------------
>
> Key: NET-354
> URL: https://issues.apache.org/jira/browse/NET-354
> Project: Commons Net
> Issue Type: Bug
> Components: FTP
> Affects Versions: 2.2
> Environment: Applies to all environments
> Reporter: Leif John Korshavn
> Fix For: 3.0
>
> Attachments: CCCTester.java, CCC_bugs_in_FTPSClient.patch
>
>
> FTPSClient does not behave properly after issuing CCC (Clear Command
> Channel). Proper behaviour is to close SSLSocket, but keep underlying
> connection without SSL open.
> To achieve this, the SSLSocket should be created with "false", like this on
> line 255 (of FTPSClient v2.2)
> SSLSocket socket =
> (SSLSocket) ssf.createSocket(_socket_, ip, port, false);
> Furthermore, on sendCommand CCC, sslSocket must be closed before setting
> _socket = _plainsocket on line 493:
> _socket.close();
> _socket = _plainsocket;
> ...
> And finally, it is wrong to set socket factory to null on line 500 of the
> same method; this is set properly in exexPROT and should not be reset on CCC.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira