简体   繁体   English

ldap_add():添加:引荐

[英]ldap_add(): Add: Referral

I'm trying to add the user to my LDAP server. 我正在尝试将该用户添加到我的LDAP服务器。 But I'm getting the below error. 但是我收到以下错误。

PHP Warning:  ldap_add(): Add: Referral

Code:
$ds = ldap_connect("HOST","PORT"); 
if ($ds) {
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
$bind = ldap_bind($ds, "adminusername", "Passwrd");
echo $bind;
// prepare data
$base_dn = 'CN=Manus Test,OU=UserAccounts,DC=rk.com,DC=rk';
$info["givenName"]="manu";
$info["sn"]="Manu";
$info["uid"]="manus";
$info["homeDirectory"]="/home/";
$info["mail"]="manus@gmail.com";
$info["displayName"]= "Jdkd sjs";
$info["cn"] ="Manus Test";
//$info["userPassword"]=>user_hash;
$info["objectclass"][0] = "top";
$info["objectclass"][1] = "person";
$info["objectclass"][2] = "inetOrgPerson";
$info["objectclass"][3] = "organizationalPerson";

// add data to directory
$r = ldap_add($ds, $base_dn, $info);
echo "Bind result is " . $r . "<br />";

Please let me know any suggestions. 请让我知道任何建议。

Referrals can be returned if you are talking to a slave LDAP server (essentially a read-only copy of the directory). 如果您正在与从属LDAP服务器(本质上是目录的只读副本)进行对话,则可以返回引用。 If you know you are talking to a server hosting a writable copy of the replica, referrals are also returned when the DN base is not something hosted by that server. 如果您知道您正在与托管副本的可写副本的服务器通信,则当DN基础不是该服务器托管的内容时,也会返回引用。

Looking at the code above, "DC=rk.com,DC=rk" is unusual. 看上面的代码,“ DC = rk.com,DC = rk”是不寻常的。 I generally see the "domain" components broken out so rk.com becomes "dc=rk,dc=com". 我通常会看到“域”组件被破坏,因此rk.com变成了“ dc = rk,dc = com”。 Use an ldap browser to verify the pattern for fully qualified DNs in your directory. 使用ldap浏览器验证目录中标准DN的模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM