Rory,

Niklas Gustavsson wrote:
Niklas Gustavsson wrote:
Rory Winston wrote:
The FTPSClient needs the have a SSL enabled ServerSocketFactory set, e.g.:
client.setServerSocketFactory(SSLServerSocketFactory.getDefault());

I believe that the following patch which sets the server socket factory to one that is SSL enabled solves the bug where commons-net FTPSClient will fail on entering PROT P mode in active mode.

If you rather would like this as a JIRA issue, please tell me and I'll create an issue.

/niklas
Index: src/main/java/org/apache/commons/net/ftp/FTPSClient.java
===================================================================
--- src/main/java/org/apache/commons/net/ftp/FTPSClient.java    (revision 
468975)
+++ src/main/java/org/apache/commons/net/ftp/FTPSClient.java    (working copy)
@@ -25,6 +25,7 @@
 
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLException;
+import javax.net.ssl.SSLServerSocketFactory;
 import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManager;
@@ -380,8 +381,10 @@
             throw new SSLException(getReplyString());
         if (DEFAULT_PROT.equals(prot)) {
             setSocketFactory(null);
+            setServerSocketFactory(null);
         } else {
             setSocketFactory(new FTPSSocketFactory(context));
+            setServerSocketFactory(SSLServerSocketFactory.getDefault());
         }
     }
 
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to