int ldb_kv_delete_noindex(struct ldb_module *module,
			  const struct ldb_message *msg)
{
	void *data = ldb_module_get_private(module);
	struct ldb_kv_private *ldb_kv =
	    talloc_get_type(data, struct ldb_kv_private);
	struct ldb_val key;
	int ret;
	TALLOC_CTX *tdb_key_ctx = talloc_new(module);

	if (tdb_key_ctx == NULL) {
		return ldb_module_oom(module);
	}

	if (ldb_kv->read_only) {
		talloc_free(tdb_key_ctx);
		return LDB_ERR_UNWILLING_TO_PERFORM;
	}

	key = ldb_kv_key_msg(module, tdb_key_ctx, msg);
	if (!key.data) {
		TALLOC_FREE(tdb_key_ctx);
		return LDB_ERR_OTHER;
	}

	ret = ldb_kv->kv_ops->delete(ldb_kv, key);
	TALLOC_FREE(tdb_key_ctx);

	if (ret != 0) {
		ret = ldb_kv->kv_ops->error(ldb_kv);
	}

	return ret;
}
int ldb_kv_delete_noindex(struct ldb_module *module,
			  const struct ldb_message *msg)
{
	void *data = ldb_module_get_private(module);
	struct ldb_kv_private *ldb_kv =
	    talloc_get_type(data, struct ldb_kv_private);
	struct ldb_val key;
	int ret;
	TALLOC_CTX *tdb_key_ctx = talloc_new(module);

	if (tdb_key_ctx == NULL) {
		return ldb_module_oom(module);
	}

	if (ldb_kv->read_only) {
		talloc_free(tdb_key_ctx);
		return LDB_ERR_UNWILLING_TO_PERFORM;
	}

	key = ldb_kv_key_msg(module, tdb_key_ctx, msg);
	if (!key.data) {
		TALLOC_FREE(tdb_key_ctx);
		return LDB_ERR_OTHER;
	}

	ret = ldb_kv->kv_ops->delete(ldb_kv, key);
	TALLOC_FREE(tdb_key_ctx);

	if (ret != 0) {
		ret = ldb_kv->kv_ops->error(ldb_kv);
	}

	return ret;
}