commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Lichtas (JIRA)" <>
Subject [jira] [Commented] (NET-354) FTPSClient not properly supporting CCC and PROT P
Date Tue, 12 Apr 2011 21:48:05 GMT


Erick Lichtas commented on NET-354:

I also noticed that the CCC implementation was not correct.  I have applied this patch locally
and it does not appear that the autoClose flag set when creating the SSLSocket works as expected
when the SSLSocket.close() is called.

If _socket_.close() is called during the handling of the CCC command, the subsequent command
(for example SYST) fails with Software caused connection abort:
socket write error.  The error specifically happens during the getReply() when reading a line
from the controlInput which comes back null.  I've tested this on Windows using java 1.5 and
1.6 and got the same results.  I'm not sure if it behaves any different on linux.

Caused by: Software caused connection abort: socket write error
	at Method)
	at sun.nio.cs.StreamEncoder.writeBytes(
	at sun.nio.cs.StreamEncoder.implFlushBuffer(
	at sun.nio.cs.StreamEncoder.implFlush(
	at sun.nio.cs.StreamEncoder.flush(

If I leave the autoClose option true and simply discard the SSLSocket:

// _socket_.close();
_socket_ = _plainSocket 

all subsequent commands are executed without problems. 

> FTPSClient not properly supporting CCC and PROT P
> -------------------------------------------------
>                 Key: NET-354
>                 URL:
>             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: 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:

View raw message