From 4c1927265189f886e793fb6ae3ecc97c9019f68c Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 26 Aug 1999 21:00:22 +0000 Subject: [PATCH] Assert ID != NOID when fetching from the datastore. Add additional abandon point to modrdn. test005-modrdn still shows error. Likely in dn2id, index, or idl codes. --- servers/slapd/back-ldbm/dn2id.c | 7 +++++++ servers/slapd/back-ldbm/modrdn.c | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/servers/slapd/back-ldbm/dn2id.c b/servers/slapd/back-ldbm/dn2id.c index e157edcd17..ca3a2803dc 100644 --- a/servers/slapd/back-ldbm/dn2id.c +++ b/servers/slapd/back-ldbm/dn2id.c @@ -28,6 +28,7 @@ dn2id_add( struct ldbminfo *li = (struct ldbminfo *) be->be_private; Debug( LDAP_DEBUG_TRACE, "=> dn2id_add( \"%s\", %ld )\n", dn, id, 0 ); + assert( id != NOID ); if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT )) == NULL ) { @@ -141,6 +142,8 @@ dn2id( (void) memcpy( (char *) &id, data.dptr, sizeof(ID) ); + assert( id != NOID ); + ldbm_datum_free( db->dbc_db, data ); Debug( LDAP_DEBUG_TRACE, "<= dn2id %ld\n", id, 0, 0 ); @@ -196,6 +199,8 @@ dn2id_delete( Debug( LDAP_DEBUG_TRACE, "=> dn2id_delete( \"%s\", %ld )\n", dn, id, 0 ); + assert( id != NOID ); + if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT )) == NULL ) { Debug( LDAP_DEBUG_ANY, @@ -213,7 +218,9 @@ dn2id_delete( key.dsize = strlen( pdn ) + 2; key.dptr = ch_malloc( key.dsize ); sprintf( key.dptr, "%c%s", DN_ONE_PREFIX, pdn ); + (void) idl_delete_key( be, db, key, id ); + free( key.dptr ); free( pdn ); } diff --git a/servers/slapd/back-ldbm/modrdn.c b/servers/slapd/back-ldbm/modrdn.c index d07f68021e..e04d7bca0d 100644 --- a/servers/slapd/back-ldbm/modrdn.c +++ b/servers/slapd/back-ldbm/modrdn.c @@ -261,6 +261,14 @@ ldbm_back_modrdn( Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: new ndn=%s\n", new_ndn, 0, 0 ); + /* check for abandon */ + ldap_pvt_thread_mutex_lock( &op->o_abandonmutex ); + if ( op->o_abandon ) { + ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex ); + goto return_results; + } + + ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex ); if (dn2id ( be, new_ndn ) != NOID) { send_ldap_result( conn, op, LDAP_ALREADY_EXISTS, NULL, NULL, NULL, NULL ); -- 2.39.5