/* cache.c - routines to maintain an in-core cache of entries */
/* $OpenLDAP$ */
/*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
return( 0 );
}
-/*
- * cache_find_entry_dn2id - find an entry in the cache, given dn
- */
-
-ID
-cache_find_entry_dn2id(
- Backend *be,
- Cache *cache,
- const char *dn
-)
-{
- int rc;
- struct berval bv;
- struct berval *ndn = NULL;
- ID id;
-
- bv.bv_val = dn;
- bv.bv_len = strlen( dn );
-
- rc = dnNormalize( NULL, &bv, &ndn );
- if( rc != LDAP_SUCCESS ) {
- return NOID;
- }
-
- id = cache_find_entry_ndn2id( be, cache, ndn->bv_val );
-
- ber_bvfree( ndn );
- return ( id );
-}
-
ID
cache_find_entry_ndn2id(
Backend *be,
Cache *cache,
- const char *ndn
+ struct berval *ndn
)
{
Entry e, *ep;
int count = 0;
/* this function is always called with normalized DN */
- e.e_ndn = (char *)ndn;
+ e.e_nname = *ndn;
try_again:
/* set cache mutex */
#ifdef NEW_LOGGING
LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
"cache_find_entry_dn2id: (%s) %ld not ready: %d\n",
- ndn, id, state ));
+ ndn->bv_val, id, state ));
#else
Debug(LDAP_DEBUG_TRACE,
"====> cache_find_entry_dn2id(\"%s\"): %ld (not ready) %d\n",
- ndn, id, state);
+ ndn->bv_val, id, state);
#endif
#ifdef NEW_LOGGING
LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1,
"cache_find_entry_dn2id: (%s): %ld %d tries\n",
- ndn, id, count ));
+ ndn->bv_val, id, count ));
#else
Debug(LDAP_DEBUG_TRACE,
"====> cache_find_entry_dn2id(\"%s\"): %ld (%d tries)\n",
- ndn, id, count);
+ ndn->bv_val, id, count);
#endif