且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

LDAP 问题,ldap_bind 无效的 dn 语法

更新时间:2022-01-21 08:27:24

如错误中所述,您的绑定 DN 格式错误.DN 代表对象的完整路径 - 所以在你的情况下应该是这样的(看起来你在 AD 上?)

As stated in the error, your bind DN is the wrong format. DN's represent the full path to the object - so in your case should be something like this (looks like you're on AD?)

"cn=username,ou=域用户,dc=example,dc=com"

"cn=username,ou=domain users,dc=example,dc=com"

根据您的 LDAP(Active Directory、OpenLDAP 等)的风格,您可能能够使用 uid(所以只是用户名")进行绑定,但***假设您总是需要完整的 DN.

Depending on your flavor of LDAP (Active Directory, OpenLDAP etc), you might be able to use a uid (so just 'username') to bind, but it's best to assume that you always need the full DN.

您可以使用诸如 Apache Directory Studio 之类的 LDAP 工具来帮助构建查询并找出对象的DN 是.或者也有 ldp.exe(前提是它是 AD),但是 directory studio 更容易使用.

You can use an LDAP tool like Apache Directory Studio to help build queries and find out what object's DN's are. Or there's ldp.exe too (provided it's AD), but directory studio is easier to use.