From 6c01508f0cf156eda036740c53a9768e39970a7e Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 13 Apr 2004 16:49:12 +0000 Subject: [PATCH] cleanup needed for tool mode compatibility (may need work) --- servers/slapd/back-ldbm/cache.c | 4 ++++ servers/slapd/back-ldbm/entry.c | 4 ++++ servers/slapd/back-ldbm/id2entry.c | 12 ++++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/servers/slapd/back-ldbm/cache.c b/servers/slapd/back-ldbm/cache.c index 3286863495..b4477927d5 100644 --- a/servers/slapd/back-ldbm/cache.c +++ b/servers/slapd/back-ldbm/cache.c @@ -99,6 +99,10 @@ cache_return_entry_rw( Cache *cache, Entry *e, int rw ) ID id; int refcnt, freeit = 1; + if ( slapMode != SLAP_SERVER_MODE ) { + return; + } + /* set cache mutex */ ldap_pvt_thread_mutex_lock( &cache->c_mutex ); diff --git a/servers/slapd/back-ldbm/entry.c b/servers/slapd/back-ldbm/entry.c index ab9e40863f..f4d732d24d 100644 --- a/servers/slapd/back-ldbm/entry.c +++ b/servers/slapd/back-ldbm/entry.c @@ -52,6 +52,10 @@ ldbm_back_entry_release_rw( #endif } else { + if ( e->e_private ) { + free( e->e_private ); + e->e_private = NULL; + } entry_free( e ); } diff --git a/servers/slapd/back-ldbm/id2entry.c b/servers/slapd/back-ldbm/id2entry.c index 0c3ae59f50..0f680fe460 100644 --- a/servers/slapd/back-ldbm/id2entry.c +++ b/servers/slapd/back-ldbm/id2entry.c @@ -259,7 +259,9 @@ id2entry_rw( Backend *be, ID id, int rw ) e->e_id = id; - if( cache_add_entry_rw( &li->li_cache, e, rw ) != 0 ) { + if ( slapMode == SLAP_SERVER_MODE + && cache_add_entry_rw( &li->li_cache, e, rw ) != 0 ) + { entry_free( e ); /* XXX this is a kludge. @@ -300,9 +302,11 @@ id2entry_rw( Backend *be, ID id, int rw ) rw ? "w" : "r", id, (unsigned long) e ); #endif - /* marks the entry as committed, so it will get added to the cache - * when the lock is released */ - cache_entry_commit( e ); + if ( slapMode == SLAP_SERVER_MODE ) { + /* marks the entry as committed, so it will get added to the cache + * when the lock is released */ + cache_entry_commit( e ); + } return( e ); } -- 2.39.5