#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    2
    Rep Power
    0

    filter on 2 organizational units


    I need to run a query on an LDAP server but rather than pass a base DN for my search, I need to look in 2 different organizational units. ie.

    baseDN = "ou=People,o=Company"

    filter "(cn=johndoe)"

    but I want to look in 2 org units under people, there may be 100s of units but I only want to search within 2.

    I thought it would be something like...
    filter "(&(cn=johndoe)(|(ou=group1)(ou=group2)))"

    Eric
  2. #2
  3. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    Your filter WILL work and just put the base dn as o=Company should get you the results but it's not how you think it works.

    You DON'T specify the base dn within the filter, it is added seperately. If your server is indexed on cn then searching with a basedn of o=Company should get you a pretty fast result.

IMN logo majestic logo threadwatch logo seochat tools logo