tl->entries = entries;
                        }
                        tl->entries[tl->ecount++] = e;
+                       e->e_id = tl->ecount;
                        return rc;
                }
 
        return rc;
 }
 
+static int
+ldif_back_entry_release_rw (
+       Operation *op,
+       Entry *e,
+       int rw )
+{
+       ID id = e->e_id;
+
+       /* only tool mode assigns valid IDs */
+       if ( id != 0 && id != NOID )
+       {
+               struct ldif_tool *tl = &((struct ldif_info *) op->o_bd->be_private)->li_tool;
+
+               id--;
+
+               assert( id < tl->ecount );
+               assert( e == tl->entries[id] );
+               tl->entries[id] = NULL;
+       }
+
+       entry_free( e );
+       return 0;
+}
+
 
 /* Slap tools */
 
        return ldif_tool_entry_next( be );
 }
 
+static ID
+ldif_tool_dn2id_get( BackendDB *be, struct berval *dn )
+{
+       struct ldif_tool *tl = &((struct ldif_info *) be->be_private)->li_tool;
+
+       Operation op = {0};
+
+       op.o_bd = be;
+       op.o_req_dn = *dn;
+       op.o_req_ndn = *dn;
+       op.ors_scope = LDAP_SCOPE_BASE;
+       if ( search_tree( &op, NULL ) != LDAP_SUCCESS ) {
+               return NOID;
+       }
+       return tl->ecount;
+}
+
 static Entry *
 ldif_tool_entry_get( BackendDB *be, ID id )
 {
        --id;
        if ( id < tl->ecount ) {
                e = tl->entries[id];
-               tl->entries[id] = NULL;
        }
        return e;
 }
        return NOID;
 }
 
+static ID
+ldif_tool_entry_modify( BackendDB *be, Entry *e, struct berval *text )
+{
+       int rc;
+       const char *errmsg = NULL;
+       struct berval path;
+       Operation op = {0};
+
+       op.o_bd = be;
+       ndn2path( &op, &e->e_nname, &path, 0 );
+       rc = ldif_write_entry( &op, e, &path, NULL, &errmsg );
+       SLAP_FREE( path.bv_val );
+       if ( rc == LDAP_SUCCESS )
+               return 1;
+
+       if ( errmsg == NULL && rc != LDAP_OTHER )
+               errmsg = ldap_err2string( rc );
+       if ( errmsg != NULL )
+               snprintf( text->bv_val, text->bv_len, "%s", errmsg );
+       return NOID;
+}
+
 
 /* Setup */
 
        bi->bi_connection_destroy = 0;
 
        bi->bi_entry_get_rw = ldif_back_entry_get;
+       bi->bi_entry_release_rw = ldif_back_entry_release_rw;
 
 #if 0  /* NOTE: uncomment to completely disable access control */
        bi->bi_access_allowed = slap_access_always_allowed;
        bi->bi_tool_entry_first = backend_tool_entry_first;
        bi->bi_tool_entry_first_x = ldif_tool_entry_first_x;
        bi->bi_tool_entry_next = ldif_tool_entry_next;
+       bi->bi_tool_dn2id_get = ldif_tool_dn2id_get;
        bi->bi_tool_entry_get = ldif_tool_entry_get;
        bi->bi_tool_entry_put = ldif_tool_entry_put;
+       bi->bi_tool_entry_modify = ldif_tool_entry_modify;
        bi->bi_tool_entry_reindex = 0;
        bi->bi_tool_sync = 0;
 
-       bi->bi_tool_dn2id_get = 0;
-       bi->bi_tool_entry_modify = 0;
-
        bi->bi_cf_ocs = ldifocs;
 
        rc = config_register_schema( ldifcfg, ldifocs );