From 57deefc94fd09a966c7f720892c4520608a24590 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Wed, 26 Jul 2000 19:48:02 +0000 Subject: [PATCH] Working slapindex! --- servers/slapd/back-ldbm/tools.c | 22 ++++++++++++++++++++-- tests/data/slapd.conf | 2 +- tests/scripts/test003-search | 17 ++++++++--------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/servers/slapd/back-ldbm/tools.c b/servers/slapd/back-ldbm/tools.c index 835d5616e0..2cf78c9cb4 100644 --- a/servers/slapd/back-ldbm/tools.c +++ b/servers/slapd/back-ldbm/tools.c @@ -137,6 +137,10 @@ Entry* ldbm_tool_entry_get( BackendDB *be, ID id ) e = str2entry( data.dptr ); ldbm_datum_free( id2entry->dbc_db, data ); + if( e != NULL ) { + e->e_id = id; + } + return e; } @@ -197,9 +201,19 @@ int ldbm_tool_entry_reindex( ID id ) { int rc; - Entry *e = ldbm_tool_entry_get( be, id ); + Entry *e; + + Debug( LDAP_DEBUG_ARGS, "=> ldbm_tool_entry_reindex( %ld )\n", + (long) id, 0, 0 ); - if( e == NULL ) return -1; + e = ldbm_tool_entry_get( be, id ); + + if( e == NULL ) { + Debug( LDAP_DEBUG_ANY, + "ldbm_tool_entry_reindex:: could not locate id=%ld\n", + (long) id, 0, 0 ); + return -1; + } /* * just (re)add them for now @@ -207,6 +221,10 @@ int ldbm_tool_entry_reindex( * will zap index databases * */ + + Debug( LDAP_DEBUG_TRACE, "=> ldbm_tool_entry_reindex( %ld, \"%s\" )\n", + id, e->e_dn, 0 ); + rc = index_entry_add( be, e, e->e_attrs ); entry_free( e ); diff --git a/tests/data/slapd.conf b/tests/data/slapd.conf index 23228a81a8..0cac379f7f 100644 --- a/tests/data/slapd.conf +++ b/tests/data/slapd.conf @@ -22,7 +22,7 @@ suffix "o=University of Michigan, c=US" directory ./test-db rootdn "cn=Manager, o=University of Michigan, c=US" rootpw secret -index objectClass eq +index objectclass eq index cn,sn,uid pres,eq,sub dbnosync dbnolocking diff --git a/tests/scripts/test003-search b/tests/scripts/test003-search index ce868f9cdd..dadad8a179 100755 --- a/tests/scripts/test003-search +++ b/tests/scripts/test003-search @@ -18,21 +18,20 @@ echo "Cleaning up in $DBDIR..." rm -f $DBDIR/[!C]* echo "Running slapadd to build slapd database..." -# $SLAPADD -f $MCONF -l $LDIF -$SLAPADD -f $CONF -l $LDIF +$SLAPADD -f $MCONF -l $LDIF RC=$? if test $RC != 0 ; then echo "slapadd failed ($RC)!" exit $RC fi -# echo "Running slapindex to index slapd database..." -# $SLAPINDEX -f $CONF -# RC=$? -# if test $RC != 0 ; then -# echo "slapindex failed ($RC)!" -# exit $RC -# fi +echo "Running slapindex to index slapd database..." +$SLAPINDEX -f $CONF +RC=$? +if test $RC != 0 ; then + echo "slapindex failed ($RC)!" + exit $RC +fi echo "Starting slapd on TCP/IP port $PORT..." $SLAPD -f $CONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 & -- 2.39.5