Bug 48516 - NullPointerException in JNDIRealm
NullPointerException in JNDIRealm
Status: RESOLVED FIXED
Product: Tomcat 5
Classification: Unclassified
Component: Catalina
5.5.28
PC All
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-01-11 05:42 UTC by Kevin Conaway
Modified: 2010-03-03 16:51 UTC (History)
0 users



Attachments
Patch to fix NPE (56.80 KB, text/x-java)
2010-01-11 05:42 UTC, Kevin Conaway
Details
Patch to fix NPE (677 bytes, application/octet-stream)
2010-01-11 05:46 UTC, Kevin Conaway
Details

Note You need to log in before you can comment on or make changes to this bug.
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.