mirror of
https://github.com/nicolabs/ldap-plugin.git
synced 2025-09-07 05:14:24 +02:00
[FIXED HUDSON-2959] Fix broken images by adding rootUrl in image links returned by
checkName; avoid NullPointerException in LDAP groupname lookup when groupSearchBase is not set. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15006 71c3de6d-444a-0410-be80-ed276b4c234a Originally-Committed-As: f6e780339fe674a71cbf8e693b6a8fba01e90b52
This commit is contained in:
parent
0c863c6bd5
commit
ad2eedb6f6
|
@ -250,8 +250,8 @@ public class LDAPSecurityRealm extends SecurityRealm {
|
|||
if(Util.fixEmptyAndTrim(rootDN)==null) rootDN=Util.fixNull(inferRootDN(server));
|
||||
this.rootDN = rootDN.trim();
|
||||
this.userSearchBase = userSearchBase.trim();
|
||||
if(Util.fixEmptyAndTrim(userSearch)==null) userSearch="uid={0}";
|
||||
this.userSearch = userSearch.trim();
|
||||
userSearch = Util.fixEmptyAndTrim(userSearch);
|
||||
this.userSearch = userSearch!=null ? userSearch : "uid={0}";
|
||||
this.groupSearchBase = Util.fixEmptyAndTrim(groupSearchBase);
|
||||
this.managerDN = Util.fixEmpty(managerDN);
|
||||
this.managerPassword = Scrambler.scramble(Util.fixEmpty(managerPassword));
|
||||
|
@ -327,7 +327,8 @@ public class LDAPSecurityRealm extends SecurityRealm {
|
|||
@Override
|
||||
public GroupDetails loadGroupByGroupname(String groupname) throws UsernameNotFoundException, DataAccessException {
|
||||
// TODO: obtain a DN instead so that we can obtain multiple attributes later
|
||||
final Set<String> groups = (Set<String>)ldapTemplate.searchForSingleAttributeValues(groupSearchBase, GROUP_SEARCH,
|
||||
String searchBase = groupSearchBase != null ? groupSearchBase : "";
|
||||
final Set<String> groups = (Set<String>)ldapTemplate.searchForSingleAttributeValues(searchBase, GROUP_SEARCH,
|
||||
new String[]{groupname}, "cn");
|
||||
|
||||
if(groups.isEmpty())
|
||||
|
|
Loading…
Reference in a new issue