我已经花了足够的时间来查看这个问题了,我可以说,ldap 引用,至少在尝试添加、修改或删除从服务器上的记录时,该从服务器会正确地将引用传递给主服务器,在 php 中不起作用。我的建议是关闭 ldap 引用,并使用内置引用处理编写你自己的添加、修改和删除函数。类似于这样
<?php
function ldap_referral_add($connection,$add_dn,$Add_entry,$bind_dn,$bind_pw)
{
$rconnection = $connection;
$loop = 10; ldap_get_option($connection,LDAP_OPT_REFERRALS,$old_referral_setting)
do
{
$response = ldap_add($rconnection,$dn,$entry);
if ( $response )
{
ldap_unbind($rconnection);
$loop = 0; ldap_set_option($connection,LDAP_OPT_REFERRALS,$old_referral_setting);
return true;
}
elseif ( !$response && ldap_errno($rconnection) == 0x0a )
{
$new_server_url = $server= preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $ldap_error($rconnection)); $rconnection = ldap_connect($new_server_url);
ldap_set_option($rconnection,LDAP_OPT_REFERRALS,0)
ldap_set_option($rconnection,LDAP_OPT_PROTOCOL_VERSION, 3)
ldap_bind($rconnection,$bind_dn,$bind_pw);
$loop = $loop - 1;
}
else
{
ldap_unbind($rconnection);
$loop = 0; ldap_set_option($connection,LDAP_OPT_REFERRALS,$old_referral_setting);
return false;
}
} while ( $loop > 0);
}
?>