簡體   English   中英

為什么php ldap_search在同一查詢中返回不同的屬性?

[英]Why does php ldap_search return different attributes within the same query?

我正在通過ldap_search運行Active Directory的查詢,並返回ldap_get_entries嘗試獲取LastLogin,whenCreated,pwdLastSet。

返回的第一個用戶沒有索引(返回了約42個屬性),但第二個用戶卻沒有索引(返回了約75個屬性)。 在總集合中,有很多沒有,但是沒有想要的字段。 我無法確定帳戶中的任何差異。

它們在相同的OU中,並且在MMC的“屬性”選項卡中顯示相同的屬性,並且值中包含數據,我將fields數組設置為空以返回全部,我嘗試使用端口3268和389並使用ldap // 。 我什至嘗試查詢GC持有人與非GC持有人,但得到相同的結果。

DC是Windows Server 2016和帶有Apache2的PHPv7。

$dc = 'domain controller';
$ds = ldap_connect('ldap//' . $dc . ':389');
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);

$ldap_bind = ldap_bind($ds, $ldap_un, $ldap_pwd);

$dn = "OU=$parent_ou,DC=<domain>,DC=com";

$filter = '';
$fields = array();
$attrs_only = 0; # default
$size_limit = 0; # unlimited
$time_limit = 0; # no limit
$deref = 0;

$sr = ldap_search($ds, $dn, $filter, $attrs_only, $size_limit, $time_limit, $deref);

$arr_entries = ldap_get_entries($sr);

查詢連接,綁定並返回> 500個條目。

我希望為每個條目返回相同的屬性,即使它們返回了NULL(not_set),但即使存在數據,它們的返回方式也不同。

誰能幫助我確定原因以及如何糾正它?

提前致謝。

似乎問題是權限。 顯然我用來綁定的帳戶沒有足夠的權限來獲取數據。 現在,我必須找出為什么在三台服務器中的兩台上采用這種方式。 有關更多信息,請訪問AD訪問控制

謝謝您的幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM