开发者

How to list OU's in an OU?

I would like to output all the OU's that are in the test OU.

my $mesg = $ldap->search(
    base => "OU=test,OU=company,DC=example,DC=com",
    scope => 'sub',
    filter =&g开发者_开发知识库t; '(objectClass=*)',
    attrs => ['*'],
    );

print Dumper $mesg->entry;

When I do the search like so, I only get information about the test OU, and not which OU's it contain.

Any ideas how to do that?


$mesg will have array of entries. You are trying to print the first entry from the search result.

Try,

print Dumper $mesg

also change your filter to

filter => '(objectClass=organizationalUnit)'

ldapsearch start the search from the base dn and including basedn. Here OU=test,OU=company,DC=example,DC=com is also organizationalunit so this entry is coming as a first entry in the result for you and you are printing only that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜