From 527e19a5c1bef5df9ae1e99b89ff2d425d9d41e9 Mon Sep 17 00:00:00 2001 From: funkman Date: Sun, 20 May 2007 18:33:16 +0000 Subject: [PATCH] JNDIRealm does not catch NullPointerException for Sun's LDAP provider git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@539907 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/realm/JNDIRealm.java | 17 +++++++++++++++++ webapps/docs/changelog.xml | 7 ++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/realm/JNDIRealm.java b/java/org/apache/catalina/realm/JNDIRealm.java index a5144c616..6b99df5da 100644 --- a/java/org/apache/catalina/realm/JNDIRealm.java +++ b/java/org/apache/catalina/realm/JNDIRealm.java @@ -808,6 +808,23 @@ public class JNDIRealm extends RealmBase { // Authenticate the specified username if possible principal = authenticate(context, username, credentials); + } catch (NullPointerException e) { + /* BZ 42449 - Kludge Sun's LDAP provider + with broken SSL + */ + // log the exception so we know it's there. + containerLog.warn(sm.getString("jndiRealm.exception"), e); + + // close the connection so we know it will be reopened. + if (context != null) + close(context); + + // open a new directory context. + context = open(); + + // Try the authentication again. + principal = authenticate(context, username, credentials); + } catch (CommunicationException e) { // log the exception so we know it's there. diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 81a749bc8..c45001169 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -18,7 +18,12 @@ - 42444: prevent NPE + 42449: + JNDIRealm does not catch NullPointerException for Sun's + LDAP provider (See bug for details) (funkman) + + + 42444: prevent NPE for AccessLogValve Patch provided by Nils Hammar (funkman) -- 2.11.0