Spring Security
  1. Spring Security
  2. SEC-992

SpringSecurityLdapTemplate: clearing the returningObjFlag of SearchControls contradicts contract with LdapTemplate

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.3
    • Fix Version/s: 3.0.0 M1
    • Component/s: LDAP
    • Labels:
      None
    • Environment:
      all

      Description

      In method searchForSingleAttributeValues(String, String, Object[], String) of class SpringSecurityLdapTemplate, on line 168, there is this call:

      ctls.setReturningObjFlag(false);

      Then the search(String, String, Object[], String) method is called with a context mapper, which implies that returnObj must be true in SearchControls. LdapTemplate checks the returningObjFlag state, and if it is false, sets it to true. It also emits an INFO log entry about the inconsistency.

      The documentation of class SearchControls states for the controls argument:

      "The <code>SearchControls</code> to use in the search. If the

      • returnObjFlag is not set in the <code>SearchControls</code>,
      • this method will set it automatically, as this is required for
      • the <code>ContextMapper</code> to work.
        "

      Setting the returningObjFlag to false is at best superfluous, at worst some behavior of the search is desired, which cannot be achieved this way.

        Activity

        Hide
        Luke Taylor added a comment -

        Thanks. I've made the change as suggested (removing the setReturnObjFlag(false)). Not sure why it was there to start with.

        Show
        Luke Taylor added a comment - Thanks. I've made the change as suggested (removing the setReturnObjFlag(false)). Not sure why it was there to start with.

          People

          • Assignee:
            Luke Taylor
            Reporter:
            Jürgen Failenschmid
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: