Understaing NET::LDAP

M

Michael Hill

I have a LDAP query like:

my $basedn = "ou=people,o=myhost.com";
my $scope = "sub";
my $filter = "manager=uid=fred,ou=people,o=myhost.com";

$searchobj = $conn->search( base=>$basedn, scope=>$scope,
filter=>$filter, attrs=>$attrs );

my $max = $searchobj->count;

## iterate through the hash
for($i = 0 ; $i < $max ; $i++)
{
my $entry = $searchobj->entry($i);
foreach my $attr ($entry->attributes)
{
#iterate over the fields
}
}

Only thing is that I'd like to limit the records being returned.

The object "manager" could look like either
ex1:
uid=fred,ou=people,o=myhost.com
uid=fred_boss,ou=people,o=myhost.com
uid=fred_boss_boss,ou=people,o=myhost.com
ex2:
uid=works_for_fred,ou=people,o=myhost.com
uid=fred,ou=people,o=myhost.com
uid=fred_boss,ou=people,o=myhost.com
uid=fred_boss_boss,ou=people,o=myhost.com

So .... since I am searching for "uid=fred,ou=people,o=myhost.com" I get
both rows.

I can limit the output in the "foreach" step, but I'd like to limit the
number of records matching the search in the filter so the script
processes quicker.

Anyone have any idea how to enhance the filter further?

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top