Author: violetagg Date: Fri Nov 14 15:03:58 2014 New Revision: 1639660 URL: http://svn.apache.org/r1639660 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57208 Merged revision(s) 1639653 from tomcat/trunk: Fixed NPE in JNDIRealm when "getUserBySearch" is performed, and no results are found. Based on a patch made by Jason McIntosh.
Modified: tomcat/tc8.0.x/trunk/ (props changed) tomcat/tc8.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc8.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1639653 Modified: tomcat/tc8.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java?rev=1639660&r1=1639659&r2=1639660&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java Fri Nov 14 15:03:58 2014 @@ -1276,11 +1276,17 @@ public class JNDIRealm extends RealmBase // Use pattern or search for user entry if (userPatternFormatArray != null && curUserPattern >= 0) { user = getUserByPattern(context, username, credentials, attrIds, curUserPattern); + if (containerLog.isDebugEnabled()) { + containerLog.debug("Found user by pattern [" + user + "]"); + } } else { user = getUserBySearch(context, username, attrIds); + if (containerLog.isDebugEnabled()) { + containerLog.debug("Found user by search [" + user + "]"); + } } - if (userPassword == null && credentials != null) { + if (userPassword == null && credentials != null && user != null) { // The password is available. Insert it since it may be required for // role searches. return new User(user.getUserName(), user.getDN(), credentials, Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1639660&r1=1639659&r2=1639660&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Fri Nov 14 15:03:58 2014 @@ -50,6 +50,11 @@ <fix> <bug>57187</bug>: Regression handling the special * URL. (remm) </fix> + <fix> + <bug>57208</bug>: Prevent NPE in JNDI Realm when no results are found + in a directory context for a user with specified user name. Based on + a patch provided by Jason McIntosh. (violetagg) + </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