spring-projects / spring-security

Spring Security
http://spring.io/projects/spring-security
Apache License 2.0
8.67k stars 5.84k forks source link

SEC-992: SpringSecurityLdapTemplate: clearing the returningObjFlag of SearchControls contradicts contract with LdapTemplate #1242

Closed spring-projects-issues closed 15 years ago

spring-projects-issues commented 15 years ago

["Jürgen Failenschmid":https://jira.spring.io/secure/ViewProfile.jspa?name=jfai](Migrated from ["SEC-992":https://jira.spring.io/browse/SEC-992?redirect=false]) said:

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 SearchControls to use in the search. If the * returnObjFlag is not set in the SearchControls, * this method will set it automatically, as this is required for * the ContextMapper 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.

spring-projects-issues commented 15 years ago

["Luke Taylor":https://jira.spring.io/secure/ViewProfile.jspa?name=luke] said:

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