문제

I need to retrieve all Organizational Units from a given DN stringh, I am using Net::LDAP module and this little script:

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

For example if dn returns that string:

CN=Sample Sample,OU=One,OU=Two,DC=sample1,DC=sample2

I want to retrieve One and Two.

도움이 되었습니까?

해결책

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".

다른 팁

Most detailed "(&(ou=*)(objectClass=organizationalunit))"

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top