This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new ca22e19 Simplify configuration style checks
ca22e19 is described below
commit ca22e193b0d6293b3331ed9478b131897c1c3019
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Feb 28 20:28:19 2019 +0000
Simplify configuration style checks
Now all TLS capable connectors support both JSSE and OpenSSL
configuration styles, the code that checks for a compatible
configuration style can be a lot simpler.
---
.../apache/tomcat/util/net/AbstractEndpoint.java | 3 --
.../tomcat/util/net/AbstractJsseEndpoint.java | 13 --------
java/org/apache/tomcat/util/net/AprEndpoint.java | 8 -----
java/org/apache/tomcat/util/net/SSLHostConfig.java | 37 ++--------------------
4 files changed, 2 insertions(+), 59 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index c4a4583..6a6f86e 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -223,7 +223,6 @@ public abstract class AbstractEndpoint<S,U> {
}
if (bindState != BindState.UNBOUND && bindState !=
BindState.SOCKET_CLOSED_ON_STOP &&
isSSLEnabled()) {
- sslHostConfig.setConfigType(getSslConfigType());
try {
createSSLContext(sslHostConfig);
} catch (Exception e) {
@@ -302,8 +301,6 @@ public abstract class AbstractEndpoint<S,U> {
return sslHostConfigs.values().toArray(new SSLHostConfig[0]);
}
- protected abstract SSLHostConfig.Type getSslConfigType();
-
/**
* Create the SSLContextfor the the given SSLHostConfig.
*
diff --git a/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java
b/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java
index dba6c4c..1ebc873 100644
--- a/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java
@@ -29,8 +29,6 @@ import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLParameters;
import org.apache.tomcat.util.compat.JreCompat;
-import org.apache.tomcat.util.net.SSLHostConfig.Type;
-import org.apache.tomcat.util.net.openssl.OpenSSLImplementation;
import org.apache.tomcat.util.net.openssl.ciphers.Cipher;
public abstract class AbstractJsseEndpoint<S,U> extends AbstractEndpoint<S,U> {
@@ -65,22 +63,11 @@ public abstract class AbstractJsseEndpoint<S,U> extends
AbstractEndpoint<S,U> {
}
- @Override
- protected Type getSslConfigType() {
- if
(OpenSSLImplementation.class.getName().equals(sslImplementationName)) {
- return SSLHostConfig.Type.EITHER;
- } else {
- return SSLHostConfig.Type.JSSE;
- }
- }
-
-
protected void initialiseSsl() throws Exception {
if (isSSLEnabled()) {
sslImplementation =
SSLImplementation.getInstance(getSslImplementationName());
for (SSLHostConfig sslHostConfig : sslHostConfigs.values()) {
- sslHostConfig.setConfigType(getSslConfigType());
createSSLContext(sslHostConfig);
}
diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 737e8d2..b9f15d0 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -55,7 +55,6 @@ import org.apache.tomcat.util.buf.ByteBufferUtils;
import org.apache.tomcat.util.collections.SynchronizedStack;
import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
import org.apache.tomcat.util.net.Acceptor.AcceptorState;
-import org.apache.tomcat.util.net.SSLHostConfig.Type;
import org.apache.tomcat.util.net.openssl.OpenSSLContext;
import org.apache.tomcat.util.net.openssl.OpenSSLUtil;
@@ -192,12 +191,6 @@ public class AprEndpoint extends
AbstractEndpoint<Long,Long> implements SNICallB
@Override
- protected Type getSslConfigType() {
- return SSLHostConfig.Type.EITHER;
- }
-
-
- @Override
public InetSocketAddress getLocalAddress() throws IOException {
long s = serverSock;
if (s == 0) {
@@ -371,7 +364,6 @@ public class AprEndpoint extends
AbstractEndpoint<Long,Long> implements SNICallB
// Initialize SSL if needed
if (isSSLEnabled()) {
for (SSLHostConfig sslHostConfig : sslHostConfigs.values()) {
- sslHostConfig.setConfigType(getSslConfigType());
createSSLContext(sslHostConfig);
}
SSLHostConfig defaultSSLHostConfig =
sslHostConfigs.get(getDefaultSSLHostConfigName());
diff --git a/java/org/apache/tomcat/util/net/SSLHostConfig.java
b/java/org/apache/tomcat/util/net/SSLHostConfig.java
index b88aa2b..4bd539b 100644
--- a/java/org/apache/tomcat/util/net/SSLHostConfig.java
+++ b/java/org/apache/tomcat/util/net/SSLHostConfig.java
@@ -22,11 +22,9 @@ import java.io.IOException;
import java.io.Serializable;
import java.security.KeyStore;
import java.security.UnrecoverableKeyException;
-import java.util.EnumMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import javax.management.ObjectName;
@@ -65,8 +63,6 @@ public class SSLHostConfig implements Serializable {
}
private Type configType = null;
- private Type currentConfigType = null;
- private Map<Type, Set<String>> configuredProperties = new
EnumMap<>(Type.class);
private String hostName = DEFAULT_SSL_HOST_NAME;
@@ -152,39 +148,11 @@ public class SSLHostConfig implements Serializable {
public String getConfigType() {
return configType.name();
}
- public void setConfigType(Type configType) {
- this.configType = configType;
- if (configType == Type.EITHER) {
- if (configuredProperties.remove(Type.JSSE) == null) {
- configuredProperties.remove(Type.OPENSSL);
- }
- } else {
- configuredProperties.remove(configType);
- }
- for (Map.Entry<Type,Set<String>> entry :
configuredProperties.entrySet()) {
- for (String property : entry.getValue()) {
- log.warn(sm.getString("sslHostConfig.mismatch",
- property, getHostName(), entry.getKey(), configType));
- }
- }
- }
void setProperty(String name, Type configType) {
if (this.configType == null) {
- Set<String> properties = configuredProperties.get(configType);
- if (properties == null) {
- properties = new HashSet<>();
- configuredProperties.put(configType, properties);
- }
- properties.add(name);
- } else if (this.configType == Type.EITHER) {
- if (currentConfigType == null) {
- currentConfigType = configType;
- } else if (currentConfigType != configType) {
- log.warn(sm.getString("sslHostConfig.mismatch",
- name, getHostName(), configType, currentConfigType));
- }
+ this.configType = configType;
} else {
if (configType != this.configType) {
log.warn(sm.getString("sslHostConfig.mismatch",
@@ -872,8 +840,7 @@ public class SSLHostConfig implements Serializable {
public enum Type {
JSSE,
- OPENSSL,
- EITHER
+ OPENSSL
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]