static struct dom_sid *idmap_msg_get_dom_sid(TALLOC_CTX *mem_ctx,
		struct ldb_message *msg, const char *attr_name)
{
	struct dom_sid *sid;
	const struct ldb_val *val;
	enum ndr_err_code ndr_err;

	val = ldb_msg_find_ldb_val(msg, attr_name);
	if (val == NULL) {
		return NULL;
	}

	sid = talloc(mem_ctx, struct dom_sid);
	if (sid == NULL) {
		return NULL;
	}

	ndr_err = ndr_pull_struct_blob(val, sid, sid,
				       (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
		talloc_free(sid);
		return NULL;
	}

	return sid;
}
static struct dom_sid *idmap_msg_get_dom_sid(TALLOC_CTX *mem_ctx,
		struct ldb_message *msg, const char *attr_name)
{
	struct dom_sid *sid;
	const struct ldb_val *val;
	enum ndr_err_code ndr_err;

	val = ldb_msg_find_ldb_val(msg, attr_name);
	if (val == NULL) {
		return NULL;
	}

	sid = talloc(mem_ctx, struct dom_sid);
	if (sid == NULL) {
		return NULL;
	}

	ndr_err = ndr_pull_struct_blob(val, sid, sid,
				       (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
		talloc_free(sid);
		return NULL;
	}

	return sid;
}