免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: hxlxsj
打印 上一主题 下一主题

[ldap] ldap连接本地服务器问题 [复制链接]

论坛徽章:
0
21 [报告]
发表于 2005-02-27 12:56 |只看该作者

ldap连接本地服务器问题

原帖由 "hxlxsj" 发表:
在php文件中写入:
$ds=ldap_connect("localhost","389";
$r = ldap_bind($ds,"cn=abcd,o=myadmin","secret";
错误报告如下:
ldap_bind(): Unable to bind to server: Protocol error in  ...

难道是密码(s..........



LDAP_v2  _v3的错误

两种办法:
1。在你的php  ldap_bind之前加上下面的一段]
if (ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
    echo "Using LDAPv3"."<br />;";
} else {
    echo "Failed to set protocol version to 3"."<br />;";
}

2。在你的slapd.conf里面加上一句:allow bind_v2

论坛徽章:
0
22 [报告]
发表于 2005-02-28 08:42 |只看该作者

ldap连接本地服务器问题

谢谢leave
我用您介绍的两种方法均试过,但仍有错误报告:
Unable to bind to server: Invalid credentials in ......

论坛徽章:
0
23 [报告]
发表于 2005-02-28 11:38 |只看该作者

ldap连接本地服务器问题

Fatal error: Call to undefined function: ldap_connect()
表示你的PHP没有将LDAP支持编译进去。
请检查一下PHP配制。

论坛徽章:
0
24 [报告]
发表于 2005-02-28 11:52 |只看该作者

ldap连接本地服务器问题

谢谢NetSnake
我现在是在win2000下能连接openldap服务器,只是不能绑定,请指教!
我的问题在已经一个星期了,请各位高手帮帮忙!

论坛徽章:
0
25 [报告]
发表于 2005-02-28 13:06 |只看该作者

ldap连接本地服务器问题

我在php ldap_bind之前加上下面的一段:
if (ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
echo "Using LDAPv3"."<br />;";
} else {
echo "Failed to set protocol version to 3"."<br />;";
}
能够通过,显示"Using LDAPv3".
但仍是错误信息:Unable to bind to server: Invalid credentials in...


我在slapd.conf中加入allow bind_v2后,openldap服务器起不来,显示为:
.......
bdb_db_init:Initializing BDB database
.\slapd.conf:line 80:allow line must appear prior to database definitions
.\slapd.conf:line 80:unknown feature bind_v3 in "allow <features>;" line
slapd shutdown:freeing system resources.

请高手们指点。谢谢
slapd stopped.
connections_destroy:nothing to destroy.

论坛徽章:
0
26 [报告]
发表于 2005-02-28 17:55 |只看该作者

ldap连接本地服务器问题

我记得PHP 4.x都不可以用LDAP v3的。
还有,很多系统都首先尝试使用匿名用户连接,你要看看slapd.conf里面关于访问权限的配制。

应该是你的slapd.conf配制不太合适,你可以把配制文件贴上来看看。

论坛徽章:
0
27 [报告]
发表于 2005-03-01 08:33 |只看该作者

ldap连接本地服务器问题

谢谢,我的slapd.conf如下:
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
ucdata-path        C:/openldap/ucdata
include                C:/openldap/etc/schema/core.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                C:/openldap/var/run/slapd.pid
argsfile        C:/openldap/var/run/slapd.args

# Load dynamic backend modules:
# modulepath        C:/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        C:/openldap/var/openldap-data
#
# Indices to maintain
#
index objectClass eq
#
#index cn,sn,uid
#index default none

allow bind_v2

论坛徽章:
0
28 [报告]
发表于 2005-03-01 09:53 |只看该作者

ldap连接本地服务器问题

试试把allow bind_v2 放到args_file后面。
还有,你的错误提示怎么是allow bind_v3 ?

论坛徽章:
0
29 [报告]
发表于 2005-03-01 09:58 |只看该作者

ldap连接本地服务器问题

ldap_bind($ds,"cn=abcd,o=myadmin","secret";
的意思是用cn=adcd,o=myadmin绑定ds,
可是在你的slapd.conf中
是这个
suffix "dc=my-domain,dc=com"

rootdn "cn=Manager,dc=my-domain,dc=com"
你到底使用的那个呀!

论坛徽章:
0
30 [报告]
发表于 2005-03-01 13:50 |只看该作者

ldap连接本地服务器问题

问题解决了吗?如果解决了的话,怎么处理的,发上来看看。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP