This is an automated email from the ASF dual-hosted git repository. remm 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 5ee1573 Avoid possibly useless environment restore in JNDI realm 5ee1573 is described below commit 5ee15738dc48f82fdedfc000d3b704f588685625 Author: remm <r...@apache.org> AuthorDate: Mon Dec 16 11:35:54 2019 +0100 Avoid possibly useless environment restore in JNDI realm --- java/org/apache/catalina/realm/JNDIRealm.java | 17 +++++++++-------- webapps/docs/changelog.xml | 4 ++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/java/org/apache/catalina/realm/JNDIRealm.java b/java/org/apache/catalina/realm/JNDIRealm.java index ee71d0a..b069538 100644 --- a/java/org/apache/catalina/realm/JNDIRealm.java +++ b/java/org/apache/catalina/realm/JNDIRealm.java @@ -1527,7 +1527,6 @@ public class JNDIRealm extends RealmBase { containerLog.debug("Found user by search [" + user + "]"); } } - if (userPassword == null && credentials != null && user != null) { // The password is available. Insert it since it may be required for // role searches. @@ -2222,7 +2221,7 @@ public class JNDIRealm extends RealmBase { try { User user = getUser(open(), username, null); - if (user == null) { + if (user == null) { // User should be found... return null; } else { @@ -2341,12 +2340,14 @@ public class JNDIRealm extends RealmBase { roles = getRoles(context, user); } } finally { - restoreEnvironmentParameter(context, - Context.SECURITY_AUTHENTICATION, preservedEnvironment); - restoreEnvironmentParameter(context, - "javax.security.sasl.server.authentication", preservedEnvironment); - restoreEnvironmentParameter(context, "javax.security.sasl.qop", - preservedEnvironment); + if (gssCredential != null && isUseDelegatedCredential()) { + restoreEnvironmentParameter(context, + Context.SECURITY_AUTHENTICATION, preservedEnvironment); + restoreEnvironmentParameter(context, + "javax.security.sasl.server.authentication", preservedEnvironment); + restoreEnvironmentParameter(context, "javax.security.sasl.qop", + preservedEnvironment); + } } if (user != null) { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 1f18d70..c4d600a 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -51,6 +51,10 @@ Do not store username and password as session notes during authentication if they are not needed. (kkolinko) </update> + <fix> + Avoid useless environment restore when not using GSSCredential + in JNDIRealm. (remm) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org