0
當我做在LDAP中搜索條件?
#!/usr/bin/perl -w
use strict;
use Net::LDAP;
use Data::Dumper;
my $dn="...";
my $password="xxx";
my $ldap = Net::LDAP->new('example.com') or die "[email protected]";
my $mesg = $ldap->bind($dn, password => $password);
if ($mesg->code) { die "uuuu $mesg"; }
$mesg = $ldap->search(
base => "dc=example,dc=com",
filter => "(name=LIST)",
);
print Dumper $mesg;
我得到
$VAR1 = bless({
'parent' => bless({
...
}, 'Net::LDAP'),
'entries' => [
bless({
'changes' => [],
'changetype' => 'modify',
'asn' => {
'objectName' => 'CN=LIST,OU=test group,OU=M,OU=I,DC=example,DC=com',
'attributes' => [
{
'type' => 'objectClass',
'vals' => [
'top',
'group'
]
},
{
'type' => 'cn',
'vals' => [
'LIST'
]
},
{
'type' => 'member',
'vals' => [
'CN=user1,OU=BaseUsers,DC=example,DC=com',
'CN=user2,OU=BaseUsers,DC=example,DC=com',
]
},
...
在這裏我只想輸出來自member
那些在他們的對象
objectCategory: CN=Person,CN=Schema,CN=Configuration,DC=example,DC=com
有誰知道該怎麼做?
使用[GQ](http://sf.net/projects/gqclient/)LDAP客戶端撰寫和測試查詢。 – daxim 2010-12-10 15:18:53
'(objectCategory = CN = Person,CN = Schema,CN = Configuration,DC = example,DC = com)'是一個有效的LDAP過濾器,您可以使用'&'運算符將其與另一個過濾器組合: (過濾器1)(過濾器2))' – hobbs 2010-12-11 03:45:19