You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by dl...@apache.org on 2009/05/25 10:50:33 UTC

svn commit: r778355 - /mina/ftpserver/branches/1.0.x/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java

Author: dlat
Date: Mon May 25 08:50:32 2009
New Revision: 778355

URL: http://svn.apache.org/viewvc?rev=778355&view=rev
Log:
FTPSERVER-303 Underlying plain socket in SSL passive data connections was not being closed properly.

Modified:
    mina/ftpserver/branches/1.0.x/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java

Modified: mina/ftpserver/branches/1.0.x/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/branches/1.0.x/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java?rev=778355&r1=778354&r2=778355&view=diff
==============================================================================
--- mina/ftpserver/branches/1.0.x/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java (original)
+++ mina/ftpserver/branches/1.0.x/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java Mon May 25 08:50:32 2009
@@ -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.
  *
@@ -195,7 +195,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()
@@ -234,7 +234,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.ftpserver.FtpDataConnectionFactory2#getInetAddress()
      */
     public InetAddress getInetAddress() {
@@ -243,7 +243,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.ftpserver.FtpDataConnectionFactory2#getPort()
      */
     public int getPort() {
@@ -252,7 +252,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.ftpserver.FtpDataConnectionFactory2#openConnection()
      */
     public DataConnection openConnection() throws Exception {
@@ -304,10 +304,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);
 
@@ -316,12 +316,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(
@@ -336,7 +336,7 @@
                     SSLSocket sslSocket = (SSLSocket) ssocketFactory
                             .createSocket(serverSocket, serverSocket
                                     .getInetAddress().getHostName(),
-                                    serverSocket.getPort(), false);
+                                    serverSocket.getPort(), true);
                     sslSocket.setUseClientMode(false);
 
                     // initialize server socket
@@ -359,7 +359,7 @@
                 }
                 DataConnectionConfiguration dataCfg = session.getListener()
                     .getDataConnectionConfiguration();
-                
+
                 dataSoc.setSoTimeout(dataCfg.getIdleTime() * 1000);
                 LOG.debug("Passive data connection opened");
             }
@@ -399,7 +399,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.ftpserver.DataConnectionFactory#isSecure()
      */
     public boolean isSecure() {
@@ -415,7 +415,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.ftpserver.DataConnectionFactory#isZipMode()
      */
     public boolean isZipMode() {