You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/11/13 18:16:12 UTC

[Bug 57208] New: NullPointerException on JNDIRealm when search finds no results - org.apache.catalina.realm.JNDIRealm

https://issues.apache.org/bugzilla/show_bug.cgi?id=57208

            Bug ID: 57208
           Summary: NullPointerException on JNDIRealm when search finds no
                    results - org.apache.catalina.realm.JNDIRealm
           Product: Tomcat 7
           Version: 7.0.57
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: jasonmcintosh@carfax.com

When JNDIRealm does a "getUserBySearch", and no results are found, a null
object is returned.  This causes a NPE in the next few lines where it tries to
create a user.

       if (userPatternFormatArray != null && curUserPattern >= 0) {
            user = getUserByPattern(context, username, credentials, attrIds,
curUserPattern);
        } else {
            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());
        }


Should probably be changed to:

       if (userPatternFormatArray != null && curUserPattern >= 0) {
            user = getUserByPattern(context, username, credentials, attrIds,
curUserPattern);
            containerLog.debug("Found user by pattern (" + user + ")");
        } else {
            user = getUserBySearch(context, username, attrIds);
            containerLog.debug("Found user by search (" + user + ")");
        }

        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,
                    user.getRoles(), user.getUserRoleId());
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 57208] NullPointerException on JNDIRealm when search finds no results - org.apache.catalina.realm.JNDIRealm

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57208

Konstantin Kolinko <kn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> ---
Regression from r1628538/r1628524.

Tomcat 6 does not have that code and is not affected. (It does not have
roleSearchAsUser options, an issue with which was fixed by that r1628538).

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 57208] NullPointerException on JNDIRealm when search finds no results - org.apache.catalina.realm.JNDIRealm

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57208

Violeta Georgieva <vi...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Violeta Georgieva <vi...@apache.org> ---
Hi,

Thanks for the report and patch.
This is fixed in 7.0.x and 8.0.x and will be available in 7.0.58 and 8.0.16
onwards.

Regards,
Violetag

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org