[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: (ITS#4684) Bind Operation Bug
Howard,
Seems to be a JNDI bug, because with the command line tool a cn with a apace gets added.
thanks,
Deepak
Howard Chu <hyc@symas.com> wrote:
Since it is known that DNs with spaces in them work perfectly well in
the OpenLDAP server, there is no indication of any bug in OpenLDAP
software here. Either Sun's JNDI is broken or your test program, neither
of which is our concern. This ITS will be closed.
dvohra09@yahoo.com wrote:
> Full_Name: Deepak Vohra
> Version:
> OS:
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (207.6.39.2)
>
>
> The bind operation generates an exception if the cn has a space,
> for example cn=john smith.
> javax.naming.OperationNotSupportedException: [LDAP: error code 53 -
> no global
>> superior knowledge];
>
> If a cn does not have a space in it, for example cn=johnsmith, an exception does
> not get generated.
>
>
>
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
> import javax.naming.NameAlreadyBoundException;
> import javax.naming.directory.*;
> import java.util.*;
>
> public class TestLDAP {
> final static String ldapServerName = "localhost";
> final static String rootdn = "cn=Manager,dc=example,dc=com";
> final static String rootpass = "";
> final static String rootContext = "cn=john smith, dc=example,dc=com";
>
> public static void main( String[] args ) {
> // set up environment to access the server
>
> Properties env = new Properties();
>
> env.put( Context.INITIAL_CONTEXT_FACTORY,
> "com.sun.jndi.ldap.LdapCtxFactory" );
> env.put( Context.PROVIDER_URL, "ldap://" + ldapServerName +
> "/");
> env.put( Context.SECURITY_PRINCIPAL, rootdn );
> env.put( Context.SECURITY_CREDENTIALS, rootpass );
>
> try {
> // obtain initial directory context using the
> environment
> DirContext ctx = new InitialDirContext( env );
>
> // create some random number to add to the directory
> Integer i = new Integer( 28420 );
>
> System.out.println( "Adding " + i + " to directory..."
> );
> ctx.bind("cn=myRandomInt,cn=john smith,
> dc=example,dc=com", i );
>
> i = new Integer( 98765 );
> System.out.println( "i is now: " + i );
>
> i = (Integer) ctx.lookup(
> "cn=myRandomInt,cn=bharathgowda, dc=example,dc=com" );
> System.out.println( "Retrieved i from directory with
> value: " + i );
> } catch ( NameAlreadyBoundException nabe ) {
> System.err.println( "value has already been bound!" );
> } catch ( Exception e ) {
> System.err.println( e );
> }
> }
> }
>
>
--
-- Howard Chu
Chief Architect, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc
OpenLDAP Core Team http://www.openldap.org/project/
---------------------------------
Stay in the know. Pulse on the new Yahoo.com. Check it out.