Name: krT82822 Date: 01/25/2000 (see also 4238917, 4083434) java version "1.3beta" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3beta-O) Java(TM) HotSpot Client VM (build 1.3beta-O, mixed mode) This bug is related to JNDI & LDAP. (Directory used is Nestcape Directory 4) When creating an entry in a directory whose directory has a slash, (With another tool than JNDI since you can't create an entry with slashes) The directory handle the case with double quotes, the dn looks like: "cn=group/test",ou=foo,o=somecompany.com When performing a search or a list that have this kind of DN as a result, JNDI returns names as expected (with quotes and slashes). At this point, all is OK. But when trying to access an entry with this kind of DN, or perform a search on it, JNDI throws a javax.naming.InvalidNameException: javax.naming.InvalidNameException: "cn=group/test",ou=foo,o=somecompany.com: close quote appears before end of component can't perform list() What's strange is that dn with quotes and slashes is legal for LDAP name parser, this example works well: DirContext ctx=getDirContext("ldap://rantanplan/o=somecompany.com","",""); NameParser parser=ctx.getNameParser(""); Name name=parser.parse("\"cn=group/test\",ou=groups,o=somecompany.com"); Enumeration e=name.getAll(); while(e.hasMoreElements()) { System.out.println(e.nextElement()); } It gives the following result: o=somecompany.com ou=groups cn=group/test ------------------------------------- 1/24/2000 eval1127@eng -- additional comments from user, in reply to our asking whether "/" is really valid in the middle of a DN: it is difficult to know if / is a valid character or not but it seems to be, here is the DN grammar from RFC 1779 (http://rfc.fh-koeln.de/rfc/html/rfc1779.html). <name> ::= <name-component> ( <spaced-separator> ) | <name-component> <spaced-separator> <name> <spaced-separator> ::= <optional-space> <separator> <optional-space> <separator> ::= "," | ";" <optional-space> ::= ( <CR> ) *( " " ) <name-component> ::= <attribute> | <attribute> <optional-space> "+" <optional-space> <name-component> <attribute> ::= <string> | <key> <optional-space> "=" <optional-space> <string> <key> ::= 1*( <keychar> ) | "OID." <oid> | "oid." <oid> <keychar> ::= letters, numbers, and space <oid> ::= <digitstring> | <digitstring> "." <oid> <digitstring> ::= 1*<digit> <digit> ::= digits 0-9 <string> ::= *( <stringchar> | <pair> ) | '"' *( <stringchar> | <special> | <pair> ) '"' | "#" <hex> <special> ::= "," | "=" | <CR> | "+" | "<" | ">" | "#" | ";" <pair> ::= "\" ( <special> | "\" | '"') <stringchar> ::= any character except <special> or "\" or '"' <hex> ::= 2*<hexchar> <hexchar> ::= 0-9, a-f, A-F So Is "/" part of "any character except <special> or "\" or ' " ' " ? ;) All this problems because one of our customer have a directory with slashes everywhere.... Netscape Directory returns DN like "cn=group/test",ou=....... But I think it should be cn="group/test",ou=....... But this is a case that doesn't work too. (Review ID: 100229) ======================================================================
|