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("[EMAIL PROTECTED]");
ctx.destroySubcontext("[EMAIL PROTECTED]");
return ctx;
} catch (NamingException e) {
e.printStackTrace();
return null;
}
}
public void testAddContext() {
DirContext ctx=authenticate();
try {
ctx.createSubcontext("[EMAIL PROTECTED]");
ctx.destroySubcontext("[EMAIL PROTECTED]");
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
This code crashes the server (The only thing changed
is this:
ctx.createSubcontext("[EMAIL PROTECTED]");
Hope that helps.
Cheers,
- Ole
--- Stefan Zoerner <[EMAIL PROTECTED]> wrote:
> Hi Ole
>
> Ole Ersoy wrote:
>
> > During testing trying to add a subcontext:
> >
> > "[EMAIL PROTECTED]"
> >
> > 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:
> [EMAIL PROTECTED],dc=example,dc=com
> mail: [EMAIL PROTECTED]
> 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
> [EMAIL PROTECTED],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