Search code examples
oracle-databaseldapoiddirectory-server

LDAP schema: extend one branch with another branch


I'm using OUD 12c and I would like tho achieve something like the following. Suppose I have two branches in my LDAP:

ou=users,dc=example,dc=com
ou=users_special,dc=example,dc=com

Is it possible to set on LDAP side that ou=users_special extends the ou=users branch? So every search in the ou=users branch will automatically look even at the ou=users_special.

Note: no, I can't search for the users in the base dn. Thanks

EDIT:

I try to re-explain because it seems the goal was not clear. I have two users with these two DN:

uid=user0,ou=people,dc=example,dc=com
uid=user1,ou=users,dc=example,dc=com

I need that both of these ldapsearches work.

ldapsearch -h localhost -p 1389 -b "ou=people,dc=example,dc=com" (uid=user0)
ldapsearch -h localhost -p 1389 -b "ou=people,dc=example,dc=com" (uid=user1)

Solution

  • That's not schema -- schema defines what attributes exist on an object. You're talking about a referral.

    The following LDIF creates an OU with a referral:

    dn: ou=users_special,ou=users,dc=example,dc=com
    changetype: add
    objectclass: top
    objectclass: extensibleObject
    objectclass: referral
    ou: users_special
    ref: ldap://LDAPHOST:PORT/ou=users_special,dc=example,dc=com??sub?(objectClass=inetOrgPerson)
    

    I created a user with uid "specialuser01" in ou=users_special,dc=example,dc=com. A query set to follow referrals at base ou=users,dc=example,dc=com for uid=specialuser01 returns the account that is in the

    ***Searching...
    ldap_search_s(ld, "ou=users,dc=example,dc=com", 2, "uid=specialuser01", attrList,  0, &msg)
    Getting 1 entries:
    Dn: uid=specialuser01,ou=users_special,dc=example,dc=com
    cn: special User01; 
    objectClass (4): top; person; organizationalPerson; inetOrgPerson; 
    uid: specialuser01; 
    

    However a search that doesn't follow referrals will return 0 entries.