LDAP root query syntax to search more than one specific OU

前端 未结 5 995
-上瘾入骨i
-上瘾入骨i 2020-11-30 05:47

I need to run a single LDAP query that will search through two specific organization units (OU) in the root query however I\'m having a tough go of it. I\'ve tried the follo

5条回答
  •  执笔经年
    2020-11-30 06:13

    The answer is NO you can't. Why?

    Because the LDAP standard describes a LDAP-SEARCH as kind of function with 4 parameters:

    1. The node where the search should begin, which is a Distinguish Name (DN)
    2. The attributes you want to be brought back
    3. The depth of the search (base, one-level, subtree)
    4. The filter

    You are interested in the filter. You've got a summary here (it's provided by Microsoft for Active Directory, it's from a standard). The filter is composed, in a boolean way, by expression of the type Attribute Operator Value.

    So the filter you give does not mean anything.

    On the theoretical point of view there is ExtensibleMatch that allows buildind filters on the DN path, but it's not supported by Active Directory.

    As far as I know, you have to use an attribute in AD to make the distinction for users in the two OUs.

    It can be any existing discriminator attribute, or, for example the attribute called OU which is inherited from organizationalPerson class. you can set it (it's not automatic, and will not be maintained if you move the users) with "staff" for some users and "vendors" for others and them use the filter:

    (&(objectCategory=person)(|(ou=staff)(ou=vendors)))
    

提交回复
热议问题