static int samldb_generate_next_linkid(struct samldb_ctx *ac,
				       struct dsdb_schema *schema,
				       int32_t *next_linkID)
{
	int ret;
	struct ldb_context *ldb;
	struct ldb_dn *schema_dn;
	bool linkID_used = true;

	/*
	 * Windows starts at about 0xB0000000 in order to stop potential
	 * collisions with future additions to the schema. We pass this
	 * around as a signed int sometimes, but this should be sufficient.
	 */
	*next_linkID = 0x40000000;

	ldb = ldb_module_get_ctx(ac->module);
	schema_dn = ldb_get_schema_basedn(ldb);

	while (linkID_used) {
		*next_linkID += 2;
		ret = samldb_check_linkid_used(ac, schema,
					       schema_dn, ldb,
					       *next_linkID, &linkID_used);
		if (ret != LDB_SUCCESS) {
			return ret;
		}
	}

	return LDB_SUCCESS;
}
static int samldb_generate_next_linkid(struct samldb_ctx *ac,
				       struct dsdb_schema *schema,
				       int32_t *next_linkID)
{
	int ret;
	struct ldb_context *ldb;
	struct ldb_dn *schema_dn;
	bool linkID_used = true;

	 
	*next_linkID = 0x40000000;

	ldb = ldb_module_get_ctx(ac->module);
	schema_dn = ldb_get_schema_basedn(ldb);

	while (linkID_used) {
		*next_linkID += 2;
		ret = samldb_check_linkid_used(ac, schema,
					       schema_dn, ldb,
					       *next_linkID, &linkID_used);
		if (ret != LDB_SUCCESS) {
			return ret;
		}
	}

	return LDB_SUCCESS;
}