static int replmd_prepare_commit(struct ldb_module *module)
{
	struct replmd_private *replmd_private =
		talloc_get_type(ldb_module_get_private(module), struct replmd_private);
	struct la_group *la_group, *prev;
	int ret;

	if (replmd_private->la_list != NULL) {
		DBG_NOTICE("Processing linked attributes\n");
	}

	/*
	 * Walk the list of linked attributes from DRS replication.
	 *
	 * We walk backwards, to do the first entry first, as we
	 * added the entries with DLIST_ADD() which puts them at the
	 * start of the list
	 *
	 * Links are grouped together so we process links for the same
	 * source object in one go.
	 */
	for (la_group = DLIST_TAIL(replmd_private->la_list);
	     la_group != NULL;
	     la_group = prev) {

		prev = DLIST_PREV(la_group);
		DLIST_REMOVE(replmd_private->la_list, la_group);
		ret = replmd_process_la_group(module, replmd_private,
					      la_group);
		if (ret != LDB_SUCCESS) {
			replmd_txn_cleanup(replmd_private);
			return ret;
		}
	}

	replmd_txn_cleanup(replmd_private);

	/* possibly change @REPLCHANGED */
	ret = replmd_notify_store(module, NULL);
	if (ret != LDB_SUCCESS) {
		return ret;
	}

	return ldb_next_prepare_commit(module);
}
static int replmd_prepare_commit(struct ldb_module *module)
{
	struct replmd_private *replmd_private =
		talloc_get_type(ldb_module_get_private(module), struct replmd_private);
	struct la_group *la_group, *prev;
	int ret;

	if (replmd_private->la_list != NULL) {
		DBG_NOTICE("Processing linked attributes\n");
	}

	 
	for (la_group = DLIST_TAIL(replmd_private->la_list);
	     la_group != NULL;
	     la_group = prev) {

		prev = DLIST_PREV(la_group);
		DLIST_REMOVE(replmd_private->la_list, la_group);
		ret = replmd_process_la_group(module, replmd_private,
					      la_group);
		if (ret != LDB_SUCCESS) {
			replmd_txn_cleanup(replmd_private);
			return ret;
		}
	}

	replmd_txn_cleanup(replmd_private);

	 
	ret = replmd_notify_store(module, NULL);
	if (ret != LDB_SUCCESS) {
		return ret;
	}

	return ldb_next_prepare_commit(module);
}