Directory Studio
  1. Directory Studio
  2. DIRSTUDIO-589

InvalidNameException: unexpected token for user ids starting with hash sign

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.5.0
    • Fix Version/s: 1.5.1
    • Component/s: studio-ldapbrowser
    • Labels:
      None
    • Environment:
      z/OS LDAP Server

      Description

      In our LDAP server we have user ids starting with hash sign (e.g. #123456)

      On searching an existing user
      (uid=#123456)
      DS throws this exception.
      The search works with Jarek Gawor's browser 2.8.2 I believe it also worked with DS 1.4

      !ENTRY org.apache.directory.studio.connection.core 4 4 2009-11-17 10:44:53.792
      !MESSAGE Error while performing search

      • unexpected token: 123456
        !SUBENTRY 1 org.apache.directory.studio.connection.core 4 4 2009-11-17 10:44:53.792
        !MESSAGE javax.naming.InvalidNameException: unexpected token: 123456 [Root exception is line 1:6: unexpected token: 123456]
        at org.apache.directory.shared.ldap.name.ComplexLdapDnParser.parseDn(ComplexLdapDnParser.java:55)
        at org.apache.directory.shared.ldap.name.LdapDnParser.parseInternal(LdapDnParser.java:97)
        at org.apache.directory.shared.ldap.name.LdapDN.<init>(LdapDN.java:205)
        at org.apache.directory.studio.ldapbrowser.core.utils.JNDIUtils.getDn(JNDIUtils.java:48)
        at org.apache.directory.studio.ldapbrowser.core.jobs.SearchRunnable.searchAndUpdateModel(SearchRunnable.java:331)
        at org.apache.directory.studio.ldapbrowser.core.jobs.SearchRunnable.run(SearchRunnable.java:184)
        at org.apache.directory.studio.connection.core.jobs.StudioConnectionJob.run(StudioConnectionJob.java:114)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
        Caused by: line 1:6: unexpected token: 123456
        at org.apache.directory.shared.ldap.name.AntlrDnParser.special(AntlrDnParser.java:1219)
        at org.apache.directory.shared.ldap.name.AntlrDnParser.pair(AntlrDnParser.java:932)
        at org.apache.directory.shared.ldap.name.AntlrDnParser.string(AntlrDnParser.java:777)
        at org.apache.directory.shared.ldap.name.AntlrDnParser.attributeValue(AntlrDnParser.java:517)
        at org.apache.directory.shared.ldap.name.AntlrDnParser.attributeTypeAndValue(AntlrDnParser.java:405)
        at org.apache.directory.shared.ldap.name.AntlrDnParser.relativeDistinguishedName(AntlrDnParser.java:229)
        at org.apache.directory.shared.ldap.name.AntlrDnParser.relativeDistinguishedNames(AntlrDnParser.java:307)
        at org.apache.directory.shared.ldap.name.ComplexLdapDnParser.parseDn(ComplexLdapDnParser.java:51)
        ... 7 more

      !STACK 0
      javax.naming.InvalidNameException: unexpected token: 123456 [Root exception is line 1:6: unexpected token: 123456]
      at org.apache.directory.shared.ldap.name.ComplexLdapDnParser.parseDn(ComplexLdapDnParser.java:55)
      at org.apache.directory.shared.ldap.name.LdapDnParser.parseInternal(LdapDnParser.java:97)
      at org.apache.directory.shared.ldap.name.LdapDN.<init>(LdapDN.java:205)
      at org.apache.directory.studio.ldapbrowser.core.utils.JNDIUtils.getDn(JNDIUtils.java:48)
      at org.apache.directory.studio.ldapbrowser.core.jobs.SearchRunnable.searchAndUpdateModel(SearchRunnable.java:331)
      at org.apache.directory.studio.ldapbrowser.core.jobs.SearchRunnable.run(SearchRunnable.java:184)
      at org.apache.directory.studio.connection.core.jobs.StudioConnectionJob.run(StudioConnectionJob.java:114)
      at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
      Caused by: line 1:6: unexpected token: 123456
      at org.apache.directory.shared.ldap.name.AntlrDnParser.special(AntlrDnParser.java:1219)
      at org.apache.directory.shared.ldap.name.AntlrDnParser.pair(AntlrDnParser.java:932)
      at org.apache.directory.shared.ldap.name.AntlrDnParser.string(AntlrDnParser.java:777)
      at org.apache.directory.shared.ldap.name.AntlrDnParser.attributeValue(AntlrDnParser.java:517)
      at org.apache.directory.shared.ldap.name.AntlrDnParser.attributeTypeAndValue(AntlrDnParser.java:405)
      at org.apache.directory.shared.ldap.name.AntlrDnParser.relativeDistinguishedName(AntlrDnParser.java:229)
      at org.apache.directory.shared.ldap.name.AntlrDnParser.relativeDistinguishedNames(AntlrDnParser.java:307)
      at org.apache.directory.shared.ldap.name.ComplexLdapDnParser.parseDn(ComplexLdapDnParser.java:51)
      ... 7 more

      1. DIRSTUDIO-589.patch
        3 kB
        Stefan Seelmann

        Issue Links

          Activity

          Jürgen Weber made changes -
          Link This issue relates to DIRSTUDIO-882 [ DIRSTUDIO-882 ]
          Pierre-Arnaud Marcelot made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Hide
          Pierre-Arnaud Marcelot added a comment -

          Version 1.5.1 has been released.
          Let's close this issue.

          Show
          Pierre-Arnaud Marcelot added a comment - Version 1.5.1 has been released. Let's close this issue.
          Pierre-Arnaud Marcelot made changes -
          Fix Version/s 1.5.1 [ 12314389 ]
          Pierre-Arnaud Marcelot made changes -
          Fix Version/s 1.5.1 [ 12314389 ]
          Stefan Seelmann made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Assignee Stefan Seelmann [ seelmann ]
          Resolution Fixed [ 1 ]
          Show
          Stefan Seelmann added a comment - Fixed in trunk, added tests to avoid regression. http://svn.apache.org/viewvc?rev=881973&view=rev http://svn.apache.org/viewvc?rev=882331&view=rev http://svn.apache.org/viewvc?rev=882338&view=rev
          Pierre-Arnaud Marcelot made changes -
          Component/s studio-ldapbrowser [ 12311538 ]
          Pierre-Arnaud Marcelot made changes -
          Fix Version/s 1.5.1 [ 12314389 ]
          Pierre-Arnaud Marcelot made changes -
          Link This issue is related to DIRSTUDIO-591 [ DIRSTUDIO-591 ]
          Stefan Seelmann made changes -
          Attachment DIRSTUDIO-589.patch [ 12425278 ]
          Hide
          Stefan Seelmann added a comment -

          Attached patch against "shared/trunk".

          The escaped sharp was not parsed correctly if a numeric sequence followed the sharp character (without the ESC it would be a valid hexstring)

          To fix the issue in Studio we need to release a new shared version (0.9.16). So I think the patch should be applied to trunk and merged to the schema branch.

          Show
          Stefan Seelmann added a comment - Attached patch against "shared/trunk". The escaped sharp was not parsed correctly if a numeric sequence followed the sharp character (without the ESC it would be a valid hexstring) To fix the issue in Studio we need to release a new shared version (0.9.16). So I think the patch should be applied to trunk and merged to the schema branch.
          Hide
          Jürgen Weber added a comment -

          1.4 exports the found entry as LDIF like this (abbreviated):

          dn: uid=#123456, cn=Benutzer,cn=Berechtigungen,o=rudiren
          cn: #123456
          rr-gruppe: IS#WIKI

          Show
          Jürgen Weber added a comment - 1.4 exports the found entry as LDIF like this (abbreviated): dn: uid=#123456, cn=Benutzer,cn=Berechtigungen,o=rudiren cn: #123456 rr-gruppe: IS#WIKI
          Hide
          Jürgen Weber added a comment -

          I checked, it works with 1.4 and filter (uid=#123456)

          Show
          Jürgen Weber added a comment - I checked, it works with 1.4 and filter (uid=#123456)
          Hide
          Stefan Seelmann added a comment -

          From the stacktrace I would say the problem is not the filter, but the new DN parser that is used when creating the LdapDN object from the received entry.

          I was able to reproduce:
          new LdapDN("cn=#123456"); // ok
          new LdapDN("cn=
          #123456"); // exception

          Show
          Stefan Seelmann added a comment - From the stacktrace I would say the problem is not the filter, but the new DN parser that is used when creating the LdapDN object from the received entry. I was able to reproduce: new LdapDN("cn=#123456"); // ok new LdapDN("cn= #123456"); // exception
          Hide
          Emmanuel Lecharny added a comment -

          And you said it was working well with Studio 1.4 ?

          Show
          Emmanuel Lecharny added a comment - And you said it was working well with Studio 1.4 ?
          Hide
          Jürgen Weber added a comment -

          No. Earlier we had tried, but couldn't get our z/OS custom schema into ApacheDS.

          I don't believe the problem is in the filter, as there is no exception when the user does not exist.

          Show
          Jürgen Weber added a comment - No. Earlier we had tried, but couldn't get our z/OS custom schema into ApacheDS. I don't believe the problem is in the filter, as there is no exception when the user does not exist.
          Hide
          Emmanuel Lecharny added a comment -

          Q : have you tried with ApacheDS ? (just asking because if so, it will be easier to debug)

          Show
          Emmanuel Lecharny added a comment - Q : have you tried with ApacheDS ? (just asking because if so, it will be easier to debug)
          Emmanuel Lecharny made changes -
          Resolution Invalid [ 6 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          Emmanuel Lecharny added a comment -

          I reopne the issue, as the two suggested filters don't work either...

          probably a bug in the way we parse the filter ?

          Show
          Emmanuel Lecharny added a comment - I reopne the issue, as the two suggested filters don't work either... probably a bug in the way we parse the filter ?
          Hide
          Jürgen Weber added a comment -

          > Use (uid=#123456) or (uid=\23123456) in your case.

          Both don't work and give the same exception.

          I believe the exception is on parsing the search result, if I change the ID to a non-existent user there is no exception.

          Show
          Jürgen Weber added a comment - > Use (uid=#123456) or (uid=\23123456) in your case. Both don't work and give the same exception. I believe the exception is on parsing the search result, if I change the ID to a non-existent user there is no exception.
          Emmanuel Lecharny made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Invalid [ 6 ]
          Hide
          Emmanuel Lecharny added a comment -

          The filter grammar as defined in RFC 4515 does not accept # :

          filter = '(' filtercomp ')'
          filtercomp = and / or / not / item
          item = simple / present / substring / extensible
          simple = attr filtertype assertionvalue
          assertionvalue = valueencoding
          valueencoding = 0*(normal / escaped)
          normal = UTF1SUBSET / UTFMB
          escaped = ESC HEX HEX
          UTF1SUBSET = %x01-27 / %x2B-5B / %x5D-7F
          ; UTF1SUBSET excludes 0x00 (NUL), LPAREN,
          ; RPAREN, ASTERISK, and ESC.

          Use (uid=#123456) or (uid=\23123456) in your case.

          Show
          Emmanuel Lecharny added a comment - The filter grammar as defined in RFC 4515 does not accept # : filter = '(' filtercomp ')' filtercomp = and / or / not / item item = simple / present / substring / extensible simple = attr filtertype assertionvalue assertionvalue = valueencoding valueencoding = 0*(normal / escaped) normal = UTF1SUBSET / UTFMB escaped = ESC HEX HEX UTF1SUBSET = %x01-27 / %x2B-5B / %x5D-7F ; UTF1SUBSET excludes 0x00 (NUL), LPAREN, ; RPAREN, ASTERISK, and ESC. Use (uid=#123456) or (uid=\23123456) in your case.
          Jürgen Weber created issue -

            People

            • Assignee:
              Stefan Seelmann
              Reporter:
              Jürgen Weber
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development