]> git.sur5r.net Git - openldap/commitdiff
Enabled deletion of stale index entries. (EXPERIMENTAL)
authorJuan Gomez <gomez@openldap.org>
Tue, 15 Jun 1999 20:06:16 +0000 (20:06 +0000)
committerJuan Gomez <gomez@openldap.org>
Tue, 15 Jun 1999 20:06:16 +0000 (20:06 +0000)
servers/slapd/back-ldbm/index.c

index c7bc9c1135be8f49908fdc6b3e61ed3b8c5726f0..b27327dccb27b4bc50abba09406354c131cc43e8 100644 (file)
@@ -193,7 +193,54 @@ delete_value(
 )
 {
 
-       return 0;
+       int     rc;
+       Datum   key;
+       /* XXX do we need idl ??? */
+       ID_BLOCK        *idl = NULL;
+       char    *tmpval = NULL;
+       char    *realval = val;
+       char    buf[BUFSIZ];
+
+       char    prefix = index2prefix( indextype );
+
+       ldbm_datum_init( key );
+
+       Debug( LDAP_DEBUG_TRACE,
+              "=> delete_value( \"%c%s\" )\n",
+              prefix, val, 0 );
+
+       if ( prefix != UNKNOWN_PREFIX ) {
+              unsigned int     len = strlen( val );
+
+              if ( (len + 2) < sizeof(buf) ) {
+                       realval = buf;
+             } else {
+                       /* value + prefix + null */
+                       tmpval = (char *) ch_malloc( len + 2 );
+                       realval = tmpval;
+             }
+              realval[0] = prefix;
+              strcpy( &realval[1], val );
+       }
+
+       key.dptr = realval;
+       key.dsize = strlen( realval ) + 1;
+
+       rc = idl_delete_key( be, db, key, id );
+
+       if ( tmpval != NULL ) {
+               free( tmpval );
+       }
+
+       if( idl != NULL ) {
+               idl_free( idl );
+       }
+
+       ldap_pvt_thread_yield();
+
+       Debug( LDAP_DEBUG_TRACE, "<= delete_value %d\n", rc, 0, 0 );
+
+       return( rc );
 
 }/* static int delete_value() */