Cache *cache,
const char *dn
)
+{
+ char *ndn;
+ ID id;
+
+ ndn = ch_strdup( dn );
+ (void) dn_normalize( ndn );
+
+ id = cache_find_entry_ndn2id( be, cache, ndn );
+
+ free( ndn );
+
+ return ( id );
+}
+
+ID
+cache_find_entry_ndn2id(
+ Backend *be,
+ Cache *cache,
+ const char *ndn
+)
{
Entry e, *ep;
ID id;
int count = 0;
- e.e_dn = (char *) dn;
- e.e_ndn = ch_strdup( dn );
- (void) dn_normalize( e.e_ndn );
+ /* this function is always called with normalized DN */
+ e.e_ndn = (char *)ndn;
try_again:
/* set cache mutex */
#else
Debug(LDAP_DEBUG_TRACE,
"====> cache_find_entry_dn2id(\"%s\"): %ld (not ready) %d\n",
- dn, id, state);
+ ndn, id, state);
#endif
#else
Debug(LDAP_DEBUG_TRACE,
"====> cache_find_entry_dn2id(\"%s\"): %ld (%d tries)\n",
- dn, id, count);
+ ndn, id, count);
#endif
id = NOID;
}
- free(e.e_ndn);
-
return( id );
}
assert( idp );
/* first check the cache */
- if ( (*idp = cache_find_entry_dn2id( be, &li->li_cache, dn )) != NOID ) {
+ if ( (*idp = cache_find_entry_ndn2id( be, &li->li_cache, dn )) != NOID ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"dn2id: (%s)%ld in cache.\n", dn, *idp ));
#define cache_return_entry_w(c, e) cache_return_entry_rw((c), (e), 1)
ID cache_find_entry_dn2id LDAP_P(( Backend *be, Cache *cache, const char *dn ));
+ID cache_find_entry_ndn2id LDAP_P(( Backend *be, Cache *cache, const char *ndn ));
Entry * cache_find_entry_id LDAP_P(( Cache *cache, ID id, int rw ));
int cache_delete_entry LDAP_P(( Cache *cache, Entry *e ));
void cache_release_all LDAP_P(( Cache *cache ));