From a05fa4f947ffbe2013aaee9aaa8d9978f08795f4 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sat, 5 Jan 2008 19:48:38 +0000 Subject: [PATCH] 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 --- core/src/main/java/hudson/security/LDAPSecurityRealm.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/security/LDAPSecurityRealm.java b/core/src/main/java/hudson/security/LDAPSecurityRealm.java index e230954..a978403 100644 --- a/core/src/main/java/hudson/security/LDAPSecurityRealm.java +++ b/core/src/main/java/hudson/security/LDAPSecurityRealm.java @@ -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;