FTPSERVER-303 Underlying plain socket in SSL passive data connections was not being closed properly.
git-svn-id: https://svn.apache.org/repos/asf/mina/ftpserver/branches/1.0.0@778323 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java b/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
index e84221b..62d9adb 100644
--- a/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
+++ b/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
@@ -41,7 +41,7 @@
/**
* <strong>Internal class, do not use directly.</strong>
- *
+ *
* We can get the FTP data connection using this class. It uses either PORT or
* PASV command.
*
@@ -198,7 +198,7 @@
"Data connection SSL required but not configured.");
}
- // this method does not actually create the SSL socket, due to a JVM bug
+ // this method does not actually create the SSL socket, due to a JVM bug
// (https://issues.apache.org/jira/browse/FTPSERVER-241).
// Instead, it creates a regular
// ServerSocket that will be wrapped as a SSL socket in createDataSocket()
@@ -237,7 +237,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.ftpserver.FtpDataConnectionFactory2#getInetAddress()
*/
public InetAddress getInetAddress() {
@@ -246,7 +246,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.ftpserver.FtpDataConnectionFactory2#getPort()
*/
public int getPort() {
@@ -255,7 +255,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.ftpserver.FtpDataConnectionFactory2#openConnection()
*/
public DataConnection openConnection() throws Exception {
@@ -307,10 +307,10 @@
// if no local address has been configured, make sure we use the same as the client connects from
if(localAddr == null) {
localAddr = ((InetSocketAddress)session.getLocalAddress()).getAddress();
- }
+ }
SocketAddress localSocketAddress = new InetSocketAddress(localAddr, dataConfig.getActiveLocalPort());
-
+
LOG.debug("Binding active data connection to {}", localSocketAddress);
dataSoc.bind(localSocketAddress);
@@ -319,12 +319,12 @@
if (secure) {
LOG.debug("Opening secure passive data connection");
- // this is where we wrap the unsecured socket as a SSLSocket. This is
+ // this is where we wrap the unsecured socket as a SSLSocket. This is
// due to the JVM bug described in FTPSERVER-241.
// get server socket factory
SslConfiguration ssl = getSslConfiguration();
-
+
// we've already checked this, but let's do it again
if (ssl == null) {
throw new FtpException(
@@ -339,7 +339,7 @@
SSLSocket sslSocket = (SSLSocket) ssocketFactory
.createSocket(serverSocket, serverSocket
.getInetAddress().getHostName(),
- serverSocket.getPort(), false);
+ serverSocket.getPort(), true);
sslSocket.setUseClientMode(false);
// initialize server socket
@@ -398,7 +398,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.ftpserver.DataConnectionFactory#isSecure()
*/
public boolean isSecure() {
@@ -414,7 +414,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.ftpserver.DataConnectionFactory#isZipMode()
*/
public boolean isZipMode() {