Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Failure to Bind on Valid DN

  1. #11
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    Clarification: from my previous post I would like to argue that the DistinguishedName parser is indeed performing as expected.
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

  2. #12
    Join Date
    Sep 2005
    Location
    West Bloomfield, MI
    Posts
    32

    Default

    Ahhhh... yes... right. *thumps himself in the head*. Thanks

    Appreciate you taking the time to look into it!

    Dan

  3. #13
    Join Date
    Jul 2007
    Posts
    2

    Default

    hi,

    i am having issue with LdapTemplate.search(). If the result list contains DNs with escaped backslashes, then exception occurs. Example CN=ABC\\Something causing problem. Does anyone having work around to elliminate? or at least expand my query filter to exclude those items?

    many thanks,

    exception :
    Code:
    failed org.springframework.ldap.UncategorizedLdapException: Operation failed; nested exception is javax.naming.NamingException: problem generating object using object factory 
    Root exception is org.springframework.ldap.BadLdapGrammarException: Failed to parse DN; nested exception is org.springframework.ldap.support.TokenMgrError: Lexical error at line 1, column 18.  Encountered: "\\" (92), after : ""]; remaining name ''
    Caused by: 
    javax.naming.NamingException: problem generating object using object factory 
    Root exception is org.springframework.ldap.BadLdapGrammarException: Failed to parse DN; nested exception is org.springframework.ldap.support.TokenMgrError: Lexical error at line 1, column 18.  Encountered: "\\" (92), after : ""]; remaining name ''
            at com.sun.jndi.ldap.LdapSearchEnumeration.createItem(LdapSearchEnumeration.java:111)
            at com.sun.jndi.ldap.LdapNamingEnumeration.nextAux(LdapNamingEnumeration.java:256)
            at com.sun.jndi.ldap.LdapNamingEnumeration.nextImpl(LdapNamingEnumeration.java:236)
            at com.sun.jndi.ldap.LdapNamingEnumeration.next(LdapNamingEnumeration.java:184)
            at org.springframework.ldap.LdapTemplate.search(LdapTemplate.java:271)
            at org.springframework.ldap.LdapTemplate.search(LdapTemplate.java:231)
            at org.springframework.ldap.LdapTemplate.search(LdapTemplate.java:561)
            at org.springframework.ldap.LdapTemplate.search(LdapTemplate.java:475)
            at org.springframework.ldap.LdapTemplate.search(LdapTemplate.java:423)

  4. #14
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    The following test case succeeds:
    Code:
    public void testEscapedBackslash() throws Exception {
      DistinguishedName dn = new DistinguishedName("cn=ABC\\\\Something");
      assertEquals("cn", dn.getLdapRdn(0).getKey());
      assertEquals("ABC\\Something", dn.getLdapRdn(0).getValue());
    }
    We encountered a similar problem earlier, and that was quite thoroughly investigated here.
    It seems like the DN supplied to Spring LDAP by the underlying code is invalid, and there's not much we can do about it.

    You should be able to modify your filter to exclude these entries.:
    Code:
      Filter originalFilter = <your original filter>
      AndFilter newFilter = new AndFilter();
      newFilter.and(originalFilter);
      newFilter.and(new WhitespaceWildcardsFilter("cn", "\\"));
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •