[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: getting object by its DN
> Hi everybody!
>
> Is there any simple ways to get LDAP object by its DN in OpenLDAP SDK?
>
> ldap_search() doesn't recognize filter like: dn=cn=sombody,ou=dept1,o=mycomp
> I know, that by splitting DN into cn and rest I can make search using rest of DN as base, but is that the only way?
>
> What is the cannonical approach?
A search with scope = LDAP_SCOPE_BASE, and base = dn you want to find.
Since it is an error for a search to be requested with a non-existent
base, the search is guaranteed to either fail returning LDAP_NO_SUCH_OBJECT,
or the search will succeed returning the desired object (assuming no referrals
are involved).
Randy