[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:
mindless 2009-02-02 19:36:23 +00:00
parent 0c863c6bd5
commit ad2eedb6f6

View file

@ -250,8 +250,8 @@ public class LDAPSecurityRealm extends SecurityRealm {
if(Util.fixEmptyAndTrim(rootDN)==null) rootDN=Util.fixNull(inferRootDN(server)); if(Util.fixEmptyAndTrim(rootDN)==null) rootDN=Util.fixNull(inferRootDN(server));
this.rootDN = rootDN.trim(); this.rootDN = rootDN.trim();
this.userSearchBase = userSearchBase.trim(); this.userSearchBase = userSearchBase.trim();
if(Util.fixEmptyAndTrim(userSearch)==null) userSearch="uid={0}"; userSearch = Util.fixEmptyAndTrim(userSearch);
this.userSearch = userSearch.trim(); this.userSearch = userSearch!=null ? userSearch : "uid={0}";
this.groupSearchBase = Util.fixEmptyAndTrim(groupSearchBase); this.groupSearchBase = Util.fixEmptyAndTrim(groupSearchBase);
this.managerDN = Util.fixEmpty(managerDN); this.managerDN = Util.fixEmpty(managerDN);
this.managerPassword = Scrambler.scramble(Util.fixEmpty(managerPassword)); this.managerPassword = Scrambler.scramble(Util.fixEmpty(managerPassword));
@ -327,7 +327,8 @@ public class LDAPSecurityRealm extends SecurityRealm {
@Override @Override
public GroupDetails loadGroupByGroupname(String groupname) throws UsernameNotFoundException, DataAccessException { public GroupDetails loadGroupByGroupname(String groupname) throws UsernameNotFoundException, DataAccessException {
// TODO: obtain a DN instead so that we can obtain multiple attributes later // 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"); new String[]{groupname}, "cn");
if(groups.isEmpty()) if(groups.isEmpty())