mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
ITS#4088 proposed fix
This commit is contained in:
parent
c961673d9e
commit
c44210a8bf
@ -384,7 +384,7 @@ bdb_cache_find_ndn(
|
||||
/* Walk up the tree from a child node, looking for an ID that's already
|
||||
* been linked into the cache.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
hdb_cache_find_parent(
|
||||
Operation *op,
|
||||
DB_TXN *txn,
|
||||
|
@ -212,14 +212,10 @@ int bdb_entry_return(
|
||||
e->e_nname.bv_val = NULL;
|
||||
}
|
||||
#ifndef SLAP_ZONE_ALLOC
|
||||
#ifndef BDB_HIER
|
||||
/* In tool mode the e_bv buffer is realloc'd, leave it alone */
|
||||
if( !(slapMode & SLAP_TOOL_MODE) ) {
|
||||
free( e->e_bv.bv_val );
|
||||
}
|
||||
#else
|
||||
free( e->e_bv.bv_val );
|
||||
#endif /* BDB_HIER */
|
||||
#endif /* !SLAP_ZONE_ALLOC */
|
||||
|
||||
#ifdef SLAP_ZONE_ALLOC
|
||||
|
@ -443,6 +443,7 @@ void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
|
||||
#define bdb_cache_find_id BDB_SYMBOL(cache_find_id)
|
||||
#define bdb_cache_find_info BDB_SYMBOL(cache_find_info)
|
||||
#define bdb_cache_find_ndn BDB_SYMBOL(cache_find_ndn)
|
||||
#define bdb_cache_find_parent BDB_SYMBOL(cache_find_parent)
|
||||
#define bdb_cache_modify BDB_SYMBOL(cache_modify)
|
||||
#define bdb_cache_modrdn BDB_SYMBOL(cache_modrdn)
|
||||
#define bdb_cache_release_all BDB_SYMBOL(cache_release_all)
|
||||
@ -495,6 +496,13 @@ int bdb_cache_find_id(
|
||||
u_int32_t locker,
|
||||
DB_LOCK *lock
|
||||
);
|
||||
int
|
||||
bdb_cache_find_parent(
|
||||
Operation *op,
|
||||
DB_TXN *txn,
|
||||
ID id,
|
||||
EntryInfo **res
|
||||
);
|
||||
int bdb_cache_delete(
|
||||
Cache *cache,
|
||||
Entry *e,
|
||||
|
@ -185,15 +185,12 @@ Entry* bdb_tool_entry_get( BackendDB *be, ID id )
|
||||
{
|
||||
int rc;
|
||||
Entry *e = NULL;
|
||||
#ifndef BDB_HIER
|
||||
struct berval bv;
|
||||
#endif
|
||||
|
||||
assert( be != NULL );
|
||||
assert( slapMode & SLAP_TOOL_MODE );
|
||||
assert( data.data != NULL );
|
||||
|
||||
#ifndef BDB_HIER
|
||||
DBT2bv( &data, &bv );
|
||||
|
||||
#ifdef SLAP_ZONE_ALLOC
|
||||
@ -206,7 +203,7 @@ Entry* bdb_tool_entry_get( BackendDB *be, ID id )
|
||||
if( rc == LDAP_SUCCESS ) {
|
||||
e->e_id = id;
|
||||
}
|
||||
#else
|
||||
#ifdef BDB_HIER
|
||||
{
|
||||
EntryInfo *ei = NULL;
|
||||
Operation op = {0};
|
||||
@ -217,9 +214,15 @@ Entry* bdb_tool_entry_get( BackendDB *be, ID id )
|
||||
op.o_tmpmemctx = NULL;
|
||||
op.o_tmpmfuncs = &ch_mfuncs;
|
||||
|
||||
rc = bdb_cache_find_id( &op, NULL, id, &ei, 0, 0, NULL );
|
||||
if ( rc == LDAP_SUCCESS )
|
||||
e = ei->bei_e;
|
||||
rc = bdb_cache_find_parent( &op, NULL, id, &ei );
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
bdb_cache_entryinfo_unlock( ei );
|
||||
e->e_private = ei;
|
||||
ei->bei_e = e;
|
||||
bdb_fix_dn( e, 0 );
|
||||
ei->bei_e = NULL;
|
||||
e->e_private = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return e;
|
||||
|
Loading…
Reference in New Issue
Block a user