int samdb_reference_dn_is_our_ntdsa(struct ldb_context *ldb, struct ldb_dn *base,
				    const char *attribute, bool *is_ntdsa)
{
	int ret;
	struct ldb_dn *referenced_dn;
	TALLOC_CTX *tmp_ctx = talloc_new(ldb);
	if (tmp_ctx == NULL) {
		return LDB_ERR_OPERATIONS_ERROR;
	}
	ret = samdb_reference_dn(ldb, tmp_ctx, base, attribute, &referenced_dn);
	if (ret != LDB_SUCCESS) {
		DEBUG(0, ("Failed to find object %s for attribute %s - %s\n", ldb_dn_get_linearized(base), attribute, ldb_errstring(ldb)));
		return ret;
	}

	ret = samdb_dn_is_our_ntdsa(ldb, referenced_dn, is_ntdsa);
	
	talloc_free(tmp_ctx);
	return ret;
}
int samdb_reference_dn_is_our_ntdsa(struct ldb_context *ldb, struct ldb_dn *base,
				    const char *attribute, bool *is_ntdsa)
{
	int ret;
	struct ldb_dn *referenced_dn;
	TALLOC_CTX *tmp_ctx = talloc_new(ldb);
	if (tmp_ctx == NULL) {
		return LDB_ERR_OPERATIONS_ERROR;
	}
	ret = samdb_reference_dn(ldb, tmp_ctx, base, attribute, &referenced_dn);
	if (ret != LDB_SUCCESS) {
		DEBUG(0, ("Failed to find object %s for attribute %s - %s\n", ldb_dn_get_linearized(base), attribute, ldb_errstring(ldb)));
		return ret;
	}

	ret = samdb_dn_is_our_ntdsa(ldb, referenced_dn, is_ntdsa);
	
	talloc_free(tmp_ctx);
	return ret;
}