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 09:31:29 UTC

svn commit: r778323 - /mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java

Author: dlat
Date: Mon May 25 07:31:29 2009
New Revision: 778323

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

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

Modified: mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java?rev=778323&r1=778322&r2=778323&view=diff
==============================================================================
--- mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java (original)
+++ mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java Mon May 25 07:31:29 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.
  *
@@ -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() {



Re: svn commit: r778323 - /mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java

Posted by Emmanuel Lecharny <el...@apache.org>.
Just a word about Javadoc: better than using @see to refer to the interface
or extended class's javadoc, use the @{inheritdoc} annotation. It's probably
more appropriate, and AFAIK, the generated javadoc will contain the
generated doc from the inherited class.

On Mon, May 25, 2009 at 10:53 AM, David Latorre <dv...@gmail.com> wrote:

> Oops,
>
> Fixed
>
>
> 2009/5/25 Niklas Gustavsson <ni...@protocol7.com>:
> > Thanks for fixing this David. However, this commit went into the wrong
> > branch. It should go into the
> > https://svn.apache.org/repos/asf/mina/ftpserver/branches/1.0.x/ branch
> > (the 1.0.0 is a left over that I will delete).
> >
> > /niklas
> >
> > On Mon, May 25, 2009 at 9:31 AM,  <dl...@apache.org> wrote:
> >> Author: dlat
> >> Date: Mon May 25 07:31:29 2009
> >> New Revision: 778323
> >>
> >> URL: http://svn.apache.org/viewvc?rev=778323&view=rev
> >> Log:
> >> FTPSERVER-303 Underlying plain socket in SSL passive data connections
> was not being closed properly.
> >>
> >> Modified:
> >>
>  mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
> >>
> >> Modified:
> mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
> >> URL:
> http://svn.apache.org/viewvc/mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java?rev=778323&r1=778322&r2=778323&view=diff
> >>
> ==============================================================================
> >> ---
> mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
> (original)
> >> +++
> mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
> Mon May 25 07:31:29 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.
> >>  *
> >> @@ -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() {
> >>
> >>
> >>
> >
>



-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: svn commit: r778323 - /mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java

Posted by David Latorre <dv...@gmail.com>.
Oops,

Fixed


2009/5/25 Niklas Gustavsson <ni...@protocol7.com>:
> Thanks for fixing this David. However, this commit went into the wrong
> branch. It should go into the
> https://svn.apache.org/repos/asf/mina/ftpserver/branches/1.0.x/ branch
> (the 1.0.0 is a left over that I will delete).
>
> /niklas
>
> On Mon, May 25, 2009 at 9:31 AM,  <dl...@apache.org> wrote:
>> Author: dlat
>> Date: Mon May 25 07:31:29 2009
>> New Revision: 778323
>>
>> URL: http://svn.apache.org/viewvc?rev=778323&view=rev
>> Log:
>> FTPSERVER-303 Underlying plain socket in SSL passive data connections was not being closed properly.
>>
>> Modified:
>>    mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
>>
>> Modified: mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
>> URL: http://svn.apache.org/viewvc/mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java?rev=778323&r1=778322&r2=778323&view=diff
>> ==============================================================================
>> --- mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java (original)
>> +++ mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java Mon May 25 07:31:29 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.
>>  *
>> @@ -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() {
>>
>>
>>
>

Re: svn commit: r778323 - /mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java

Posted by Niklas Gustavsson <ni...@protocol7.com>.
Thanks for fixing this David. However, this commit went into the wrong
branch. It should go into the
https://svn.apache.org/repos/asf/mina/ftpserver/branches/1.0.x/ branch
(the 1.0.0 is a left over that I will delete).

/niklas

On Mon, May 25, 2009 at 9:31 AM,  <dl...@apache.org> wrote:
> Author: dlat
> Date: Mon May 25 07:31:29 2009
> New Revision: 778323
>
> URL: http://svn.apache.org/viewvc?rev=778323&view=rev
> Log:
> FTPSERVER-303 Underlying plain socket in SSL passive data connections was not being closed properly.
>
> Modified:
>    mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
>
> Modified: mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java
> URL: http://svn.apache.org/viewvc/mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java?rev=778323&r1=778322&r2=778323&view=diff
> ==============================================================================
> --- mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java (original)
> +++ mina/ftpserver/branches/1.0.0/core/src/main/java/org/apache/ftpserver/impl/IODataConnectionFactory.java Mon May 25 07:31:29 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.
>  *
> @@ -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() {
>
>
>