This is an automated email from the ASF dual-hosted git repository. johnnyv pushed a commit to branch FTPSERVER-491 in repository https://gitbox.apache.org/repos/asf/mina-ftpserver.git
The following commit(s) were added to refs/heads/FTPSERVER-491 by this push: new 81bf47b missing variable 81bf47b is described below commit 81bf47b14ca578715b617b8bf61cb5b4b1dcdc62 Author: johnnyv <john...@apache.org> AuthorDate: Fri May 10 11:46:51 2019 -0400 missing variable --- .../org/apache/ftpserver/command/impl/AUTH.java | 68 +++++++++++----------- .../ssl/impl/DefaultSslConfiguration.java | 2 +- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/core/src/main/java/org/apache/ftpserver/command/impl/AUTH.java b/core/src/main/java/org/apache/ftpserver/command/impl/AUTH.java index 58ab386..b34837b 100644 --- a/core/src/main/java/org/apache/ftpserver/command/impl/AUTH.java +++ b/core/src/main/java/org/apache/ftpserver/command/impl/AUTH.java @@ -114,40 +114,38 @@ public class AUTH extends AbstractCommand { } } - private void secureSession(final FtpIoSession session, final String type) - throws GeneralSecurityException, FtpException { - SslConfiguration ssl = session.getListener().getSslConfiguration(); - - if (ssl != null) { - session.setAttribute(SslFilter.DISABLE_ENCRYPTION_ONCE); - - SslFilter sslFilter = new SslFilter(ssl.getSSLContext()); - if (ssl.getClientAuth() == ClientAuth.NEED) { - sslFilter.setNeedClientAuth(true); - } else if (ssl.getClientAuth() == ClientAuth.WANT) { - sslFilter.setWantClientAuth(true); - } - - // note that we do not care about the protocol, we allow both types - // and leave it to the SSL handshake to determine the protocol to - // use. Thus the type argument is ignored. - - if (ssl.getEnabledCipherSuites() != null) { - sslFilter.setEnabledCipherSuites(ssl.getEnabledCipherSuites()); - } - - if(ssl.getEnabledProtocol() != null ) { - sslFilter.setEnabledProtocols(new String[] {ssl.getEnabledProtocol()}); - } - - session.getFilterChain().addFirst(SSL_SESSION_FILTER_NAME, - sslFilter); - - if("SSL".equals(type)) { - session.getDataConnection().setSecure(true); - } - } else { - throw new FtpException("Socket factory SSL not configured"); - } + private void secureSession(final FtpIoSession session, final String type) throws GeneralSecurityException, FtpException { + SslConfiguration ssl = session.getListener().getSslConfiguration(); + + if (ssl != null) { + session.setAttribute(SslFilter.DISABLE_ENCRYPTION_ONCE); + + SslFilter sslFilter = new SslFilter(ssl.getSSLContext()); + if (ssl.getClientAuth() == ClientAuth.NEED) { + sslFilter.setNeedClientAuth(true); + } else if (ssl.getClientAuth() == ClientAuth.WANT) { + sslFilter.setWantClientAuth(true); + } + + // note that we do not care about the protocol, we allow both types + // and leave it to the SSL handshake to determine the protocol to + // use. Thus the type argument is ignored. + + if (ssl.getEnabledCipherSuites() != null) { + sslFilter.setEnabledCipherSuites(ssl.getEnabledCipherSuites()); + } + + if (ssl.getEnabledProtocol() != null) { + sslFilter.setEnabledProtocols(new String[] { ssl.getEnabledProtocol() }); + } + + session.getFilterChain().addFirst(SSL_SESSION_FILTER_NAME, sslFilter); + + if ("SSL".equals(type)) { + session.getDataConnection().setSecure(true); + } + } else { + throw new FtpException("Socket factory SSL not configured"); + } } } diff --git a/core/src/main/java/org/apache/ftpserver/ssl/impl/DefaultSslConfiguration.java b/core/src/main/java/org/apache/ftpserver/ssl/impl/DefaultSslConfiguration.java index b7f71e5..15866bc 100644 --- a/core/src/main/java/org/apache/ftpserver/ssl/impl/DefaultSslConfiguration.java +++ b/core/src/main/java/org/apache/ftpserver/ssl/impl/DefaultSslConfiguration.java @@ -134,7 +134,7 @@ public class DefaultSslConfiguration implements SslConfiguration { } // create and initialize the SSLContext - SSLContext ctx = SSLContext.getInstance(sslProtocol); + SSLContext ctx = SSLContext.getInstance(enabledProtocol); ctx.init(keyManagers, trustManagerFactory.getTrustManagers(), null); // Create the socket factory return ctx;