Hi,* I am java developer. We have an application which use Domino LDAP 5.0 as an user repository. I use following code to test my an LDAP entry DN, and got ‘cn=Ftest01’ (only, no parent directory) for an entry through JNDI. So I am assuming this is the DN for this entry:
String lsAttributes = “Actor”, “InternetAddress”, “EIPAuth”};
SearchControls ctls = new SearchControls();
ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
ctls.setCountLimit(100);
ctls.setReturningAttributes(lsAttributes);
String lsSearchFilter = “uid=” + lsUser;
//creat context
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, “simple”);
env.put(Context.PROVIDER_URL, System.getProperty(“server.ldap.url”);
env.put(Context.SECURITY_PRINCIPAL, “cn=” + ldapManager);
env.put(Context.SECURITY_CREDENTIALS, managerPassword);
// search
Attributes loAttributes = null;
try {
DirContext ctx = new InitialDirContext(env);
NamingEnumeration loSearchResult = ctx.search("", lsSearchFilter, ctls);
int i = 0;
List users = new ArrayList();
while (loSearchResult.hasMoreElements()) {
StringBuffer dnBuffer = new StringBuffer ();
SearchResult element = (SearchResult) oSearchResult.nextElement();
String name = (element.getName()).toString(); // get DN
…
- Then, I use following code to delete this try, I got following NoPermissionException, And I check the manager account which has the permission to write, delete authority:
javax.naming.NoPermissionException: [LDAP: error code 50 - Insufficient Access Rights]; remaining name ‘cn=FTest01’
code:
try {
dc = new InitialDirContext(env);
dc.destroySubcontext("cn=FTest01");
dc.close();
} catch (NamingException e1) {
e1.printStackTrace();
}
- I also try to create an new entry using following code, and I got :
R Error: [LDAP: error code 1 - Ambiguous DN specified, operation aborted]
Code:
Attributes attrs = new BasicAttributes();
String dn = "cn=FTest02";
Vector vct = new Vector();
vct.add("FTest02");
entry.put("cn", vct);
vct = new Vector();
vct.add("top");
vct.add("person");
vct.add("organizationalPerson");
vct.add("inetOrgPerson");
vct.add("dominoPerson");
entry.put("objectclass", vct);
vct = new Vector();
vct.add("FTest02");
entry.put("uid", vct);
vct = new Vector();
vct.add("abc");
entry.put("HTTPPassword", vct);
vct = new Vector();
vct.add("abcd@hotmail.com");
entry.put("MailAddress", vct);
Enumeration attrEnum = entry.keys();
while (attrEnum.hasMoreElements()) {
String type = (String) attrEnum.nextElement();
Attribute oneAttr = new BasicAttribute(type);
Vector vals = (Vector) entry.get(type);
Enumeration valEnum = vals.elements();
while (valEnum.hasMoreElements()) {
oneAttr.add((String) valEnum.nextElement());
}
attrs.put(oneAttr);
}
dc.createSubcontext(dn, attrs);
if (dc != null) {
dc.close();
}
} catch (SchemaViolationException sve) {
..
}...
Could someone tell me why this does not work – We are using Domino LDAP 5.0. Is there any specific with Domino LDAP?