1

我需要从给定的 DN stringh 中检索所有组织单位,我正在使用 Net::LDAP 模块和这个小脚本:

my $msg = $ldap->search(
    base=>'DC=sample1,DC=sample2',
    filter=>'(objectclass=User)',
);
foreach $entry ($msg->entries) {
    $dn = $entry->dn;
    #how can i retrieve OUs?
}

例如,如果 dn 返回该字符串:

CN=样品样品,OU=一,OU=二,DC=样品1,DC=样品2

我想检索一和二。

4

2 回答 2

2

Issue a one level search request using the base object dc=example1,dc=sample2 and a presence filter of (ou=*). Given those results, issue a one level search using each returned ou with a presence filter of (ou=*). For each of these searches, specify a size limit and a time limit. For more information on search requests, see "LDAP: Using ldapsearch" and "LDAP: programming practices".

于 2011-11-09T09:29:15.707 回答
0

最详细的“(&(ou=*)(objectClass=organizationalunit))”

于 2018-04-26T17:24:02.410 回答