directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole_er...@yahoo.com>
Subject Re: Possible Bug
Date Tue, 14 Feb 2006 20:50:47 GMT
Hi Stefan,

Here's some JNDI JUnit Testing code that runs fine on
0.9:

package com.pyramidetechnologies.webapp.mdc;

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;

import junit.framework.TestCase;

public class LDAPTesting extends TestCase {
	public DirContext authenticate() {
		try {
			Hashtable<String, String> env = new
Hashtable<String, String>();
//			 Set up the environment for creating the initial
context
			env.put(Context.INITIAL_CONTEXT_FACTORY, 
					"com.sun.jndi.ldap.LdapCtxFactory");
			env.put(Context.PROVIDER_URL,
"ldap://localhost:389/ou=users,ou=system");

//			 Authenticate as S. User and password "mysecret"
			env.put(Context.SECURITY_AUTHENTICATION, "simple");
			env.put(Context.SECURITY_PRINCIPAL, 
"uid=admin,ou=system");
			env.put(Context.SECURITY_CREDENTIALS, "secret");

			DirContext ctx = new InitialDirContext(env);
		
ctx.createSubcontext("mail=ole@pyramidetechnologies");
		
ctx.destroySubcontext("mail=ole@pyramidetechnologies");
			return ctx;
		} catch (NamingException e) {
			e.printStackTrace();
			return null;
		}
	}
	
	public void testAddContext() {
		DirContext ctx=authenticate();
		try {
		
ctx.createSubcontext("mail=ole@pyramidetechnologies");
		
ctx.destroySubcontext("mail=ole@pyramidetechnologies");
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}

This code crashes the server (The only thing changed
is this:

ctx.createSubcontext("mail=mail=ole@pyramidetechnologies");

Hope that helps.

Cheers,
- Ole




--- Stefan Zoerner <szoerner@apache.org> wrote:

> Hi Ole
> 
> Ole Ersoy wrote:
> 
> > During testing trying to add a subcontext:
> > 
> > "mail=mail=somebody@somewhere.com"
> > 
> > caused the connection to be terminated or at least
> not
> > accept any more authentication requests.
> > 
> 
> Can you explain in detail, which Client you use
> (JNDI program? UI 
> client, cmd line tools), and what operation you
> perform. I tried 
> something like you described, i.e. I imported an
> LDIF like this:
> 
> dn:
> mail=mail=somebody@somewhere.com,dc=example,dc=com
> mail: mail=somebody@somewhere.com
> objectclass: inetOrgPerson
> objectclass: organizationalPerson
> objectclass: person
> objectclass: top
> sn: Body
> cn: Some Body
> 
> But it failed with Softerra LDAP Administrator and
> LDAP command line tools:
> 
> $ldapadd -h localhost -p 10389 -D
> "uid=admin,ou=system" -w ? -f ole.ldif
> 
> adding new entry
> mail=mail=somebody@somewhere.com,dc=example,dc=com
> ldap_add: No such object
> ldap_add: additional info: failed to add entry
> mail=mail
> 
> I used ApacheDS 1.0RC1 btw., which may be the cause
> why it works 
> different to yours. And I am not sure, what the
> expected behavior should 
> be (e.g. Sun allows the strange DN of the entry
> above).
> 
> 
> Greetings from Hamburg,
>      Stefan
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Mime
View raw message