Skip to content
Permalink
Browse files

[FIXED JENKINS-12907] treat names as names to get escaping right, not…

… as string
  • Loading branch information
kohsuke committed Apr 26, 2012
1 parent 91c51af commit d7e074905585af53eb553a1fa05726853273c338
@@ -2,11 +2,9 @@

import hudson.Util;
import hudson.security.GroupDetails;
import hudson.security.HudsonPrivateSecurityRealm.Details;
import hudson.security.SecurityRealm;
import hudson.security.UserMayOrMayNotExistException;
import hudson.util.Secret;
import hudson.util.TimeUnit2;
import org.acegisecurity.AuthenticationException;
import org.acegisecurity.AuthenticationServiceException;
import org.acegisecurity.BadCredentialsException;
@@ -16,7 +14,6 @@
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.apache.commons.collections.map.LRUMap;
import org.apache.commons.lang.StringUtils;

import javax.naming.NamingEnumeration;
@@ -25,6 +22,7 @@
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapName;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -411,7 +409,7 @@ private String getPrincipalName(String username, String domainName) {
continue;

for (int i = 0; i<memberOf.size(); i++) {
Attributes group = context.getAttributes("\""+memberOf.get(i)+'"', new String[] { "CN", "memberOf" });
Attributes group = context.getAttributes(new LdapName(memberOf.get(i).toString()), new String[] { "CN", "memberOf" });
Attribute cn = group.get("CN");
if (cn==null) {
LOGGER.fine("Failed to obtain CN of "+memberOf.get(i));

0 comments on commit d7e0749

Please sign in to comment.
You can’t perform that action at this time.