Bug 48516

Summary: NullPointerException in JNDIRealm
Product: Tomcat 5 Reporter: Kevin Conaway <kevin.a.conaway>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 5.5.28   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Patch to fix NPE
Patch to fix NPE

Description Kevin Conaway 2010-01-11 05:42:00 UTC
Created attachment 24824 [details]
Patch to fix NPE

There is a NullPointerException being thrown when the server attempts to look up a non-existent user in JNDIRealm.

Specifically, the getUser(DirContext, String) method will return null if the user is not found.  However, getPrincipal(DirContext, String) will not check to see if the result from getUser() is null.

I'm attaching a patch from the 6.0.20 tag but this should also be backported to the 5.5.x branch as well because the issue exists there.
Comment 1 Kevin Conaway 2010-01-11 05:46:00 UTC
Created attachment 24825 [details]
Patch to fix NPE
Comment 2 Mark Thomas 2010-01-12 14:46:02 UTC
Many thanks for the patch. It has been applied to trunk and proposed for 6.0.x and 5.5.x.
Comment 3 Mark Thomas 2010-01-13 02:38:20 UTC
Thanks again for the patch. It has been applied to 6.0.x and will be included in 6.0.23 onwards.
Comment 4 Konstantin Kolinko 2010-03-03 16:51:54 UTC
Applied to 5.5, will be in 5.5.29 onwards. Thank you.