XWiki Platform
  1. XWiki Platform
  2. XWIKI-6853

LDAP connection open method fails with annonymous (empty) DN

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.2 M2
    • Fix Version/s: 3.2 M3, 3.1.1
    • Component/s: Old Core
    • Labels:
      None
    • Difficulty:
      Unknown
    • Similar issues:
      XWIKI-2779ldap authentication create empty user profile
      XWIKI-2294xwiki group mapping with ldap is not working.
      XWIKI-2747LDAP search is sometime done without the base dn
      XWIKI-2605LDAP authentication fail when user already exist and contains ldap_dn field emptied by hand
      XWIKI-2414Support for LDAP groups where the member attributes do not contain the full dn
      XWIKI-4004LDAP Users are not granted privileges of the XWiki they are in, even when the LDAP group is correctly mapped to an XWiki group.
      XWIKI-4764LDAP Auth: Only First Time Log in Allowed
      XWIKI-2774LDAP authentication fail to find already stored user DN by uid if exists
      XWIKI-2232LDAP group synchronisation fails (again)
      XWIKI-4379LDAP (Active Directory Windows 2003) authentication problem with users in more than one orginisational unit

      Description

      I fails with :

      java.lang.StringIndexOutOfBoundsException: String index out of range: 4
      at java.lang.StringBuffer.charAt(StringBuffer.java:162)
      at com.novell.ldap.LDAPDN.escapeRDN(Unknown Source)
      at com.xpn.xwiki.plugin.ldap.XWikiLDAPConnection.escapeLDAPDNValue(XWikiLDAPConnection.java:381)
      at com.xpn.xwiki.plugin.ldap.XWikiLDAPConfig.getLDAPBindDN(XWikiLDAPConfig.java:400)
      at com.xpn.xwiki.plugin.ldap.XWikiLDAPConnection.open(XWikiLDAPConnection.java:91)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
      at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:132)
      at Script1.run(Script1.groovy:84)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:576)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:614)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
      at com.xpn.xwiki.plugin.scheduler.GroovyJob.executeJob(GroovyJob.java:85)
      at com.xpn.xwiki.plugin.scheduler.AbstractJob.execute(AbstractJob.java:75)
      at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
      

        Activity

        Hide
        Jerome Velociter added a comment -

        Solution :

            public static String escapeLDAPDNValue(String value)
            {
                return StringUtils.isBlank(value) ? value : LDAPDN.escapeRDN("key=" + value).substring(4);
            }
        
        Show
        Jerome Velociter added a comment - Solution : public static String escapeLDAPDNValue( String value) { return StringUtils.isBlank(value) ? value : LDAPDN.escapeRDN( "key=" + value).substring(4); }
        Hide
        Thomas Mortagne added a comment -

        Would be nice to fix it in the stable branch too since it's easy to merge.

        Show
        Thomas Mortagne added a comment - Would be nice to fix it in the stable branch too since it's easy to merge.
        Hide
        Jerome Velociter added a comment -

        Done.

        Thanks

        Show
        Jerome Velociter added a comment - Done. Thanks

          People

          • Assignee:
            Jerome Velociter
            Reporter:
            Jerome Velociter
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Date of First Response: