Author: markt Date: Tue Sep 30 20:05:30 2014 New Revision: 1628538 URL: http://svn.apache.org/r1628538 Log: Correct a couple of NPEs in the JNDI Realm that could be triggered with when not specifying a roleBase and enabling roleSearchAsUser.
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1628524 Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java?rev=1628538&r1=1628537&r2=1628538&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java Tue Sep 30 20:05:30 2014 @@ -1297,6 +1297,13 @@ public class JNDIRealm extends RealmBase user = getUserBySearch(context, username, attrIds); } + if (userPassword == null && credentials != null) { + // The password is available. Insert it since it may be required for + // role searches. + return new User(user.getUserName(), user.getDN(), credentials, + user.getRoles(), user.getUserRoleId()); + } + return user; } @@ -1725,6 +1732,8 @@ public class JNDIRealm extends RealmBase nameParts[i] = name.get(i); } base = roleBaseFormat.format(nameParts); + } else { + base = ""; } // Perform the configured search and process the results Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1628538&r1=1628537&r2=1628538&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Sep 30 20:05:30 2014 @@ -63,6 +63,10 @@ the JNDI Realm using delegated credentials with recent Oracle JREs. (markt) </fix> + <fix> + Correct a couple of NPEs in the JNDI Realm that could be triggered with + when not specifying a roleBase and enabling roleSearchAsUser. (markt) + </fix> </changelog> </subsection> <subsection name="Web applications"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org