From c99fc315dddf707dba3a2dea6a048bd76dce4c2e Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Tue, 24 Jan 2012 14:08:10 -0800 Subject: [PATCH] [FIXED JENKINS-8152] Formatting error in the rootDN inference code. It shouldn't include attribute name. --- changelog.html | 3 +++ core/src/main/java/hudson/security/LDAPSecurityRealm.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/changelog.html b/changelog.html index 9f770ca9c8..7df33fa441 100644 --- a/changelog.html +++ b/changelog.html @@ -65,6 +65,9 @@ Upcoming changes (issue 12529)
  • Matrix job now allows delete whole matrix, including sub-jobs. +
  • + Fixed a bug in LDAP default root DN inference. + (issue 8152) diff --git a/core/src/main/java/hudson/security/LDAPSecurityRealm.java b/core/src/main/java/hudson/security/LDAPSecurityRealm.java index fbe5188b79..37f94ac1b1 100644 --- a/core/src/main/java/hudson/security/LDAPSecurityRealm.java +++ b/core/src/main/java/hudson/security/LDAPSecurityRealm.java @@ -325,8 +325,8 @@ public class LDAPSecurityRealm extends AbstractPasswordBasedSecurityRealm { DirContext ctx = new InitialDirContext(props); Attributes atts = ctx.getAttributes(""); 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(); + if(a!=null && a.get()!=null) // this entry is available on Active Directory. See http://msdn2.microsoft.com/en-us/library/ms684291(VS.85).aspx + return a.get().toString(); a = atts.get("namingcontexts"); if(a==null) {