- 论坛徽章:
- 0
|
求救!!!!!!!!!!!!!!!!!!!1
一下是我的slapd.conf
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
ucdata-path d:/openldap/ucdata
include d:/openldap/etc/schema/core.schema
include d:/openldap/etc/schema/java.schema
include d:/openldap/etc/schema/corba.schema
include d:/openldap/etc/schema/cosine.schema
include d:/openldap/etc/schema/dyngroup.schema
include d:/openldap/etc/schema/inetorgperson.schema
include d:/openldap/etc/schema/misc.schema
include d:/openldap/etc/schema/nis.schema
include d:/openldap/etc/schema/openldap.schema
# Define global ACLs to disable default read access.
# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral ldap://root.openldap.org
pidfile d:/openldap/var/run/slapd.pid
argsfile d:/openldap/var/run/slapd.args
# Load dynamic backend modules:
# modulepath d:/openldap/libexec/openldap
# moduleload back_bdb.la
# moduleload back_ldap.la
# moduleload back_ldbm.la
# moduleload back_passwd.la
# moduleload back_shell.la
# Sample security restrictions
# Require integrity protection (prevent hijacking)
# Require 112-bit (3DES or better) encryption for updates
# Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64
# Sample access control policy:
# Root DSE: allow anyone to read it
# Subschema (sub)entry DSE: allow anyone to read it
# Other DSEs:
# Allow self write access
# Allow authenticated users read access
# Allow anonymous users to authenticate
# Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
# by self write
# by users read
# by anonymous auth
#
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn. (e.g., "access to * by * read"
#
# rootdn can always read and write EVERYTHING!
#######################################################################
# BDB database definitions
#######################################################################
database bdb
suffix "dc=my-domain,dc=com"
rootdn "cn=Manager,dc=my-domain,dc=com"
# Cleartext passwords, especially for the rootdn, should
# be avoid. See slappasswd( and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw secret
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory d:/openldap/var/openldap-data
# Indices to maintain
index objectClass eq
/////////////////////////////////////////////////
以下是lizongbo.ldif
dn:dc=my-domain,dc=com
objectclass:dcObject
objectclass rganization
o:companyinfo
dc:my-domain
///////////////////////////////
以下是我的java代码
/*
* 创建日期 2006-2-16
*
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
/**
* @author Administrator
*
* TODO 要更改此生成的类型注释的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
import java.util.*;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
public class LDAPTest {
public LDAPTest() {
}
public static void main(String[] args) {
LDAPTest LDAPTest1 = new LDAPTest();
String root = "dc=my-domain,dc=com"; //root
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory" ;
env.put(Context.PROVIDER_URL, "ldap://192.168.28.253/" + root);
env.put(Context.SECURITY_AUTHENTICATION, "simple" ;
env.put(Context.SECURITY_PRINCIPAL,
"cn=Manager,dc=my-domain,dc=com" ;
env.put(Context.SECURITY_CREDENTIALS, "secret" ;
System.out.print("################################" ;
DirContext ctx = null;
try {
ctx = new InitialDirContext(env);
Person p = new Person("mewilcox","Mark","Wilcox","ou=Accounting","mewilcox@siroe.com" ;
ctx.bind("cn=mewilcox,dc=my-domain,dc=com",p);
System.out.println("认证成功" ;
}
catch (javax.naming.AuthenticationException e) {
e.printStackTrace();
System.out.println("认证失败-------------------"+e.getMessage());
e.printStackTrace();
}
catch (Exception e) {
System.out.println("认证出错==================="+e.getMessage());
e.printStackTrace();
}
if (ctx != null) {
try {
ctx.close();
}
catch (NamingException e) {
//ignore
}
}
System.exit(0);
}
}
////////////////////////////////////////////////////
现在我不知道为什么会报以下第二的错误
################################javax.naming.InvalidNameException: cn=mewilcox,dc=my-domain,dc=com: [LDAP: error code 64 - value of naming attribute 'cn' is not present in entry]; remaining name 'cn=mewilcox,dc=my-domain,dc=com'
认证出错===================cn=mewilcox,dc=my-domain,dc=com: [LDAP: error code 64 - value of naming attribute 'cn' is not present in entry]
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.c_bind(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.c_bind(Unknown Source)
at com.sun.jndi.toolkit.ctx.ComponentContext.p_bind(Unknown Source)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind(Unknown Source)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind(Unknown Source)
at javax.naming.InitialContext.bind(Unknown Source)
at LDAPTest.main(LDAPTest.java:47)
希望高手指点。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 |
|