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>
17 * dn2entry - look up dn in the cache/indexes and return the corresponding
18 * entry. If the requested DN is not found and matched is TRUE, return info
19 * for the closest ancestor of the DN. Otherwise e is NULL.
37 LDAP_LOG ( CACHE, ARGS, "bdb_dn2entry(\"%s\")\n", dn->bv_val, 0, 0 );
39 Debug(LDAP_DEBUG_TRACE, "bdb_dn2entry(\"%s\")\n",
45 rc = bdb_cache_find_entry_ndn2id( be, tid, dn, &ei, locker, ctx );
47 if ( matched && rc == DB_NOTFOUND ) {
48 /* Set the return value, whether we have its entry
52 if ( ei && ei->bei_id )
53 bdb_cache_find_entry_id( be, tid, ei->bei_id,
54 &ei, 1, locker, lock, ctx );
56 bdb_cache_entryinfo_unlock( ei );
58 bdb_cache_entryinfo_unlock( ei );
61 rc = bdb_cache_find_entry_id( be, tid, ei->bei_id, &ei, 1,
65 } else if ( matched && rc == DB_NOTFOUND ) {
66 /* always return EntryInfo */
68 bdb_cache_find_entry_id( be, tid, ei->bei_id, &ei, 1,