This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new 41f5e47 Avoid possibly useless environment restore in JNDI realm 41f5e47 is described below commit 41f5e47b717bd674474f16e2cb7f18035a303ee4 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 88ef9ce..bfae8e0 100644 --- a/java/org/apache/catalina/realm/JNDIRealm.java +++ b/java/org/apache/catalina/realm/JNDIRealm.java @@ -1535,7 +1535,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. @@ -2237,7 +2236,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 { @@ -2356,12 +2355,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 46c8375..e2bf9b8 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -57,6 +57,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