1 /* dn2entry.c - routines to deal with the dn2id / id2entry glue */
4 * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/string.h>
16 * dn2entry - look up dn in the cache/indexes and return the corresponding
17 * entry. If the requested DN is not found and matched is TRUE, return info
18 * for the closest ancestor of the DN. Otherwise e is NULL.
35 LDAP_LOG ( CACHE, ARGS, "bdb_dn2entry(\"%s\")\n", dn->bv_val, 0, 0 );
37 Debug(LDAP_DEBUG_TRACE, "bdb_dn2entry(\"%s\")\n",
43 rc = bdb_cache_find_ndn( op, tid, dn, &ei, locker );
45 if ( matched && rc == DB_NOTFOUND ) {
46 /* Set the return value, whether we have its entry
50 if ( ei && ei->bei_id )
51 bdb_cache_find_id( op, tid, ei->bei_id,
52 &ei, 1, locker, lock );
54 bdb_cache_entryinfo_unlock( ei );
56 bdb_cache_entryinfo_unlock( ei );
59 rc = bdb_cache_find_id( op, tid, ei->bei_id, &ei, 1,
63 } else if ( matched && rc == DB_NOTFOUND ) {
64 /* always return EntryInfo */
66 bdb_cache_find_id( op, tid, ei->bei_id, &ei, 1,