static int samldb_check_mapiid_used(struct samldb_ctx *ac,
				    struct dsdb_schema *schema,
				    struct ldb_dn *schema_dn,
				    struct ldb_context *ldb,
				    int32_t mapiid,
				    bool *found)
{
	int ret;
	struct ldb_result *ldb_res;

	ret = dsdb_module_search(ac->module, ac,
				 &ldb_res,
				 schema_dn, LDB_SCOPE_ONELEVEL, NULL,
				 DSDB_FLAG_NEXT_MODULE,
				 ac->req,
				 "(mAPIID=%d)", mapiid);
	if (ret != LDB_SUCCESS) {
		ldb_debug_set(ldb, LDB_DEBUG_ERROR,
			      __location__": Searching for mAPIID=%d failed - %s\n",
			      mapiid,
			      ldb_errstring(ldb));
		return ldb_operr(ldb);
	}

	*found = (ldb_res->count != 0);
	talloc_free(ldb_res);

	return LDB_SUCCESS;
}
static int samldb_check_mapiid_used(struct samldb_ctx *ac,
				    struct dsdb_schema *schema,
				    struct ldb_dn *schema_dn,
				    struct ldb_context *ldb,
				    int32_t mapiid,
				    bool *found)
{
	int ret;
	struct ldb_result *ldb_res;

	ret = dsdb_module_search(ac->module, ac,
				 &ldb_res,
				 schema_dn, LDB_SCOPE_ONELEVEL, NULL,
				 DSDB_FLAG_NEXT_MODULE,
				 ac->req,
				 "(mAPIID=%d)", mapiid);
	if (ret != LDB_SUCCESS) {
		ldb_debug_set(ldb, LDB_DEBUG_ERROR,
			      __location__": Searching for mAPIID=%d failed - %s\n",
			      mapiid,
			      ldb_errstring(ldb));
		return ldb_operr(ldb);
	}

	*found = (ldb_res->count != 0);
	talloc_free(ldb_res);

	return LDB_SUCCESS;
}