directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Temple (JIRA)" <>
Subject [jira] Created: (DIRSERVER-601) Incorrect results using Context lookup
Date Tue, 21 Mar 2006 09:01:10 GMT
Incorrect results using Context lookup

         Key: DIRSERVER-601
     Project: Directory ApacheDS
        Type: Bug
    Versions: 1.0-RC1    
 Environment: Windows - JDK 1.4.2_07
    Reporter: Simon Temple

The attached code demonstrates how a lookup using an invalid name (The VERY-BROKEN segment
should be obvious) returns a result
instead of throwing an exception:

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;

class LDAPTest

    public static void main(String[] args)
        // Identify service provider to use
        Hashtable env = new Hashtable(11);
        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.PROVIDER_URL, "ldap://localhost:10389/");
        env.put(Context.SECURITY_AUTHENTICATION, "simple");
        env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
        env.put(Context.SECURITY_CREDENTIALS, "secret");


            // Create the initial directory context
            DirContext ctx = new InitialDirContext(env);
            DirContext ctx2 = (DirContext)ctx.lookup("ou=loadedLdifFiles,VERY-BROKEN=configuration,ou=system");
            NamingEnumeration ne = ctx2.list("");
            while (ne.hasMoreElements())
                NameClassPair pair = (NameClassPair)ne.nextElement();
                System.out.println("pair: "+pair.getName()+" == "+pair.getClassName());
        catch (NamingException e)
            System.err.println("Exception: " + e);

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message