improved ActiveDirectory interoperability.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6494 71c3de6d-444a-0410-be80-ed276b4c234a

Originally-Committed-As: 282d6c448811c859028bd91f0f8e9c9f95b56dbd
This commit is contained in:
kohsuke 2008-01-05 19:48:38 +00:00
parent 6f26969b12
commit a05fa4f947

View file

@ -99,7 +99,11 @@ public class LDAPSecurityRealm extends SecurityRealm {
try {
DirContext ctx = LdapCtxFactory.getLdapCtxInstance("ldap://"+server+'/', new Hashtable());
Attributes atts = ctx.getAttributes("");
Attribute a = atts.get("namingcontexts");
Attribute a = atts.get("defaultNamingContext");
if(a!=null) // this entry is available on Active Directory. See http://msdn2.microsoft.com/en-us/library/ms684291(VS.85).aspx
return a.toString();
a = atts.get("namingcontexts");
if(a==null) {
LOGGER.warning("namingcontexts attribute not found in root DSE of "+server);
return null;