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.
36 LDAP_LOG ( CACHE, ARGS, "bdb_dn2entry(\"%s\")\n", dn->bv_val, 0, 0 );
38 Debug(LDAP_DEBUG_TRACE, "bdb_dn2entry(\"%s\")\n",
44 rc = bdb_cache_find_ndn( op, tid, dn, &ei, locker );
46 if ( matched && rc == DB_NOTFOUND ) {
47 /* Set the return value, whether we have its entry
51 if ( ei && ei->bei_id )
52 bdb_cache_find_id( op, tid, ei->bei_id,
53 &ei, 1, locker, lock );
55 bdb_cache_entryinfo_unlock( ei );
57 bdb_cache_entryinfo_unlock( ei );
60 rc = bdb_cache_find_id( op, tid, ei->bei_id, &ei, 1,
64 } else if ( matched && rc == DB_NOTFOUND ) {
65 /* always return EntryInfo */
67 bdb_cache_find_id( op, tid, ei->bei_id, &ei, 1,