From 68744ced8d3b89764d83e2bfce0e73dce822f3da Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 26 Aug 1999 00:51:27 +0000 Subject: [PATCH] fix dn2id delete bug... breaks modrdn. --- servers/slapd/back-ldbm/proto-back-ldbm.h | 2 +- servers/slapd/back-ldbm/search.c | 3 ++- servers/slapd/back-ldbm/tools.c | 2 +- tests/scripts/defines.sh | 1 + tests/scripts/test005-modrdn | 4 ++-- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/servers/slapd/back-ldbm/proto-back-ldbm.h b/servers/slapd/back-ldbm/proto-back-ldbm.h index 641c52d2b1..030a34d2f8 100644 --- a/servers/slapd/back-ldbm/proto-back-ldbm.h +++ b/servers/slapd/back-ldbm/proto-back-ldbm.h @@ -74,7 +74,7 @@ int ldbm_cache_delete LDAP_P(( DBCache *db, Datum key )); int dn2id_add LDAP_P(( Backend *be, const char *dn, ID id )); ID dn2id LDAP_P(( Backend *be, const char *dn )); ID_BLOCK *dn2idl LDAP_P(( Backend *be, const char *dn, int prefix )); -int dn2id_delete LDAP_P(( Backend *be, const char *dn )); +int dn2id_delete LDAP_P(( Backend *be, const char *dn, ID id )); Entry * dn2entry_rw LDAP_P(( Backend *be, const char *dn, Entry **matched, int rw )); #define dn2entry_r(be, dn, m) dn2entry_rw((be), (dn), (m), 0) diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index 32028a6544..720e73ab28 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -317,7 +317,8 @@ loop_continue: rc = 0; done: - idl_free( candidates ); + if( candidates != NULL ) + idl_free( candidates ); ber_bvecfree( v2refs ); if( realbase ) free( realbase ); diff --git a/servers/slapd/back-ldbm/tools.c b/servers/slapd/back-ldbm/tools.c index 889be2508e..188211f396 100644 --- a/servers/slapd/back-ldbm/tools.c +++ b/servers/slapd/back-ldbm/tools.c @@ -184,7 +184,7 @@ ID ldbm_tool_entry_put( rc = ldbm_cache_store( id2entry, key, data, LDBM_REPLACE ); if( rc != 0 ) { - (void) dn2id_delete( be, e->e_ndn ); + (void) dn2id_delete( be, e->e_ndn, e->e_id ); return NOID; } diff --git a/tests/scripts/defines.sh b/tests/scripts/defines.sh index 8e3f6b1ed3..f5855c6209 100755 --- a/tests/scripts/defines.sh +++ b/tests/scripts/defines.sh @@ -60,6 +60,7 @@ LDIFFLT=$DBDIR/ldif.flt MASTEROUT=$DBDIR/master.out SLAVEOUT=$DBDIR/slave.out TESTOUT=$DBDIR/test.out +INITOUT=$DBDIR/init.out SEARCHOUTMASTER=$DATADIR/search.out.master MODIFYOUTMASTER=$DATADIR/modify.out.master ADDDELOUTMASTER=$DATADIR/adddel.out.master diff --git a/tests/scripts/test005-modrdn b/tests/scripts/test005-modrdn index 5eabb65b36..f28aa71237 100755 --- a/tests/scripts/test005-modrdn +++ b/tests/scripts/test005-modrdn @@ -31,8 +31,8 @@ echo "Testing slapd modrdn operations..." # Make sure we can search the database for i in 0 1 2 3 4 5; do - $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \ - 'objectclass=*' > /dev/null 2>&1 + $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \ + 'objectClass=*' > $INITOUT 2>&1 RC=$? if test $RC = 1 ; then echo "Waiting 5 seconds for slapd to start..." -- 2.39.5