Issue Details (XML | Word | Printable)

Key: DIRSERVER-601
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Major Major
Assignee: Stefan Zoerner
Reporter: Simon Temple
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Directory ApacheDS

Incorrect results using Context lookup

Created: 21/Mar/06 05:00 PM   Updated: 17/Aug/06 09:03 PM
Return to search
Component/s: None
Affects Version/s: 1.0-RC1
Fix Version/s: 1.0-RC4

Time Tracking:
Not Specified

Environment: Windows - JDK 1.4.2_07

Resolution Date: 17/Aug/06 09:03 PM


 Description  « Hide
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;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;

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");

        try
        {

            // 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());
            }
            
            ctx2.close();
            ctx.close();
        }
        catch (NamingException e)
        {
            System.err.println("Exception: " + e);
            e.printStackTrace();
        }
    }
}

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Stefan Zoerner made changes - 15/Apr/06 03:05 PM
Field Original Value New Value
Assignee Stefan Zoerner [ szoerner ]
Alex Karasulu made changes - 17/Aug/06 09:03 PM
Resolution Cannot Reproduce [ 5 ]
Fix Version/s 1.0-RC4 [ 12311053 ]
Status Open [ 1 ] Closed [ 6 ]