提交 f6e78033 编写于 作者: M mindless

[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
上级 1396fd55
......@@ -270,7 +270,7 @@ public class GlobalMatrixAuthorizationStrategy extends AuthorizationStrategy {
}
private String makeImg(String gif) {
return String.format("<img src='%s/images/16x16/%s' style='margin-right:0.2em'>", Hudson.RESOURCE_PATH, gif);
return String.format("<img src='%s%s/images/16x16/%s' style='margin-right:0.2em'>", Hudson.getInstance().getRootUrlFromRequest(), Hudson.RESOURCE_PATH, gif);
}
}
}
......
......@@ -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())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册