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