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.1@778328 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 3443aa9..d01f643 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.
*
@@ -197,7 +197,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()
@@ -236,7 +236,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.ftpserver.FtpDataConnectionFactory2#getInetAddress()
*/
public InetAddress getInetAddress() {
@@ -245,7 +245,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.ftpserver.FtpDataConnectionFactory2#getPort()
*/
public int getPort() {
@@ -254,7 +254,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.ftpserver.FtpDataConnectionFactory2#openConnection()
*/
public DataConnection openConnection() throws Exception {
@@ -306,10 +306,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);
@@ -318,12 +318,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(
@@ -338,7 +338,7 @@
SSLSocket sslSocket = (SSLSocket) ssocketFactory
.createSocket(serverSocket, serverSocket
.getInetAddress().getHostName(),
- serverSocket.getPort(), false);
+ serverSocket.getPort(), true);
sslSocket.setUseClientMode(false);
// initialize server socket
@@ -361,7 +361,7 @@
}
DataConnectionConfiguration dataCfg = session.getListener()
.getDataConnectionConfiguration();
-
+
dataSoc.setSoTimeout(dataCfg.getIdleTime() * 1000);
LOG.debug("Passive data connection opened");
}
@@ -401,7 +401,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.ftpserver.DataConnectionFactory#isSecure()
*/
public boolean isSecure() {
@@ -417,7 +417,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.ftpserver.DataConnectionFactory#isZipMode()
*/
public boolean isZipMode() {