static bool pdb_samba_dsdb_sid_to_id(struct pdb_methods *m, const struct dom_sid *sid,
				 struct unixid *id)
{
	struct pdb_samba_dsdb_state *state = talloc_get_type_abort(
		m->private_data, struct pdb_samba_dsdb_state);
	struct id_map id_map;
	struct id_map *id_maps[2];
	NTSTATUS status;
	TALLOC_CTX *tmp_ctx = talloc_stackframe();
	if (!tmp_ctx) {
		return false;
	}

	ZERO_STRUCT(id_map);
	id_map.sid = discard_const_p(struct dom_sid, sid);
	id_maps[0] = &id_map;
	id_maps[1] = NULL;

	status = idmap_sids_to_xids(state->idmap_ctx, tmp_ctx, id_maps);
	talloc_free(tmp_ctx);
	if (!NT_STATUS_IS_OK(status)) {
		return false;
	}
	if (id_map.xid.type != ID_TYPE_NOT_SPECIFIED) {
		*id = id_map.xid;
		return true;
	}
	return false;
}
static bool pdb_samba_dsdb_sid_to_id(struct pdb_methods *m, const struct dom_sid *sid,
				 struct unixid *id)
{
	struct pdb_samba_dsdb_state *state = talloc_get_type_abort(
		m->private_data, struct pdb_samba_dsdb_state);
	struct id_map id_map;
	struct id_map *id_maps[2];
	NTSTATUS status;
	TALLOC_CTX *tmp_ctx = talloc_stackframe();
	if (!tmp_ctx) {
		return false;
	}

	ZERO_STRUCT(id_map);
	id_map.sid = discard_const_p(struct dom_sid, sid);
	id_maps[0] = &id_map;
	id_maps[1] = NULL;

	status = idmap_sids_to_xids(state->idmap_ctx, tmp_ctx, id_maps);
	talloc_free(tmp_ctx);
	if (!NT_STATUS_IS_OK(status)) {
		return false;
	}
	if (id_map.xid.type != ID_TYPE_NOT_SPECIFIED) {
		*id = id_map.xid;
		return true;
	}
	return false;
}