You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/01/01 01:32:13 UTC

[commons-vfs] branch master updated: upgrade ftpserver to 1.1.2 (#235)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git


The following commit(s) were added to refs/heads/master by this push:
     new 82fd1c1  upgrade ftpserver to 1.1.2 (#235)
82fd1c1 is described below

commit 82fd1c1e5f21eac571c868fe7069ce98e3ec256b
Author: XenoAmess <xe...@gmail.com>
AuthorDate: Sat Jan 1 09:32:10 2022 +0800

    upgrade ftpserver to 1.1.2 (#235)
---
 .../ftps/AbstractFtpsProviderTestCase.java         |  5 +-
 .../ftps/NoProtocolSslConfigurationProxy.java      | 68 ++++++++++++++++++++++
 pom.xml                                            |  2 +-
 3 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java
index 5b37889..bec55b0 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java
@@ -33,6 +33,7 @@ import org.apache.ftpserver.FtpServerFactory;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.UserManager;
 import org.apache.ftpserver.listener.ListenerFactory;
+import org.apache.ftpserver.ssl.SslConfiguration;
 import org.apache.ftpserver.ssl.SslConfigurationFactory;
 import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
 import org.apache.ftpserver.usermanager.impl.BaseUser;
@@ -137,7 +138,9 @@ abstract class AbstractFtpsProviderTestCase extends AbstractProviderTestConfig {
         ssl.setKeystorePassword("password");
 
         // set the SSL configuration for the listener
-        factory.setSslConfiguration(ssl.createSslConfiguration());
+        SslConfiguration sslConfiguration = ssl.createSslConfiguration();
+        NoProtocolSslConfigurationProxy noProtocolSslConfigurationProxy = new NoProtocolSslConfigurationProxy(sslConfiguration);
+        factory.setSslConfiguration(noProtocolSslConfigurationProxy);
         factory.setImplicitSsl(implicit);
 
         // replace the default listener
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/NoProtocolSslConfigurationProxy.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/NoProtocolSslConfigurationProxy.java
new file mode 100644
index 0000000..2b02258
--- /dev/null
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/NoProtocolSslConfigurationProxy.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.vfs2.provider.ftps;
+
+import java.security.GeneralSecurityException;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+
+import org.apache.ftpserver.ssl.ClientAuth;
+import org.apache.ftpserver.ssl.SslConfiguration;
+
+/**
+ * see https://issues.apache.org/jira/browse/FTPSERVER-491
+ */
+public class NoProtocolSslConfigurationProxy implements SslConfiguration {
+
+    @Override
+    public String getEnabledProtocol() {
+        return null;
+    }
+
+    private final SslConfiguration sslConfiguration;
+
+    public NoProtocolSslConfigurationProxy(SslConfiguration sslConfiguration) {
+        this.sslConfiguration = sslConfiguration;
+    }
+
+    @Override
+    public SSLSocketFactory getSocketFactory() throws GeneralSecurityException {
+        return this.sslConfiguration.getSocketFactory();
+    }
+
+    @Override
+    public SSLContext getSSLContext() throws GeneralSecurityException {
+        return this.sslConfiguration.getSSLContext();
+    }
+
+    @Override
+    public SSLContext getSSLContext(String protocol) throws GeneralSecurityException {
+        return this.sslConfiguration.getSSLContext(protocol);
+    }
+
+    @Override
+    public String[] getEnabledCipherSuites() {
+        return this.sslConfiguration.getEnabledCipherSuites();
+    }
+
+    @Override
+    public ClientAuth getClientAuth() {
+        return this.sslConfiguration.getClientAuth();
+    }
+
+}
diff --git a/pom.xml b/pom.xml
index 6f9cf29..63226c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -630,7 +630,7 @@
       <dependency>
         <groupId>org.apache.ftpserver</groupId>
         <artifactId>ftpserver-core</artifactId>
-        <version>1.1.1</version>
+        <version>1.1.2</version>
       </dependency>
       <dependency>
         <groupId>org.slf4j</groupId>