Fix for SEC-215. Check for empty nameInNameSpace before appending.

This commit is contained in:
Luke Taylor 2006-04-16 16:11:02 +00:00
parent d5885baf6b
commit 743cc9fec7
1 changed files with 9 additions and 2 deletions

View File

@ -22,7 +22,10 @@ import org.acegisecurity.ldap.LdapUtils;
import org.acegisecurity.ldap.InitialDirContextFactory;
import org.acegisecurity.ldap.LdapUserInfo;
import org.acegisecurity.ldap.LdapDataAccessException;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -136,8 +139,12 @@ public class FilterBasedLdapUserSearch implements LdapUserSearch {
userDn.append(searchBase);
}
userDn.append(",");
userDn.append(ctx.getNameInNamespace());
String nameInNamespace = ctx.getNameInNamespace();
if(StringUtils.hasLength(nameInNamespace)) {
userDn.append(",");
userDn.append(nameInNamespace);
}
return new LdapUserInfo(userDn.toString(), searchResult.getAttributes());