Another option ,if your server supports LDAPv3 extensible
matching, is to search <dc=tamu,dc=edu> for
(|(ou:dn:=dept1)(ou:dn:=dept2))
Kurt
PS: OpenLDAP does not yet support this
At 02:18 PM 2/2/01 -0600, Bing Du wrote:
>We do not have 'ou' as attribute in people's entries. It's just an
>structural part of the dn. Searching 'dc=tamu,dc=edu' definitely would
>take a very long time. Multiple searches work fine if there are not
>many ou's, say two or three, to be searched. What if there are ten or
>more? I had lived with multiple searches before I posted the question.
>Just wondering if there is any better solutions.
>
>Thanks very much for the input.
>
>Bing
>
>Bing Du <bi...@ta..., 979-845-9577>
>Texas A&M University, CIS, Operating Systems, Unix
>
>>>> Jim Harle <ha...@us...> 02/02/01 02:02PM >>>
>This depends on wheter or not your user objects also happen to have an
>ou
>attribute in addition to the structural part of the dn. We populate
>all
>of our users with an ou attribute corresponding to their lowest ou, so
>somebody might have "ou=Mathematic Department". If so, you can build
>that
>into the filter (|(ou=dept1)(ou=dept2)). If you don't hae such or if
>you
>are looking higher than is reflected, then you would need to either do
>multiple searches with multiple bases or search "dc=tamu,dc=edu" and
>then
>do something like
> $dn = $entry-dn;
> next unless ( ($dn =~ /ou\=dept1/) or ($dn =~ /ou\=dept2) );
>
>--Jim Harle
>
>
>On Fri, 2 Feb 2001, Bing Du wrote:
>
>> There are quita a few ou's under "dc=tamu,dc=edu". How should I
>specify
>> the base to just search in two ou's. For instance, what should the
>> $basedn be if I just want to look up "cn=john smith" in
>> 'ou=dept1,dc=tamu,dc=edu" and 'ou=dept2,dc=tamu,dc=edu"?
>>
>> $mesg = $ld->search(base => $basedn,scope => 'sub',filter =>
>"(cn=john
>> smith)",attrs => [],typesonly => 0);
>>
>> Thanks,
>>
>> Bing
>>
>> Bing Du <bi...@ta..., 979-845-9577>
>> Texas A&M University, CIS, Operating Systems, Unix
>>
>>
|