From eb0fca9b7b06a2aebce0da3031b1af313f0c8081 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 23 Nov 2012 16:44:41 +0100 Subject: s3:winbindd: change wb_getgrsid to use wb_sids2xids instead of wb_sid2gid Signed-off-by: Michael Adam Reviewed-by: Stefan Metzmacher --- source3/winbindd/wb_getgrsid.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'source3/winbindd') diff --git a/source3/winbindd/wb_getgrsid.c b/source3/winbindd/wb_getgrsid.c index 7d7e56a5ca..2097539e29 100644 --- a/source3/winbindd/wb_getgrsid.c +++ b/source3/winbindd/wb_getgrsid.c @@ -97,7 +97,7 @@ static void wb_getgrsid_lookupsid_done(struct tevent_req *subreq) return; } - subreq = wb_sid2gid_send(state, state->ev, &state->sid); + subreq = wb_sids2xids_send(state, state->ev, &state->sid, 1); if (tevent_req_nomem(subreq, req)) { return; } @@ -111,12 +111,27 @@ static void wb_getgrsid_sid2gid_done(struct tevent_req *subreq) struct wb_getgrsid_state *state = tevent_req_data( req, struct wb_getgrsid_state); NTSTATUS status; + struct unixid xid; - status = wb_sid2gid_recv(subreq, &state->gid); + status = wb_sids2xids_recv(subreq, &xid); TALLOC_FREE(subreq); if (tevent_req_nterror(req, status)) { return; } + + /* + * We are filtering further down in sids2xids, but that filtering + * depends on the actual type of the sid handed in (as determined + * by lookupsids). Here we need to filter for the type of object + * actually requested, in this case uid. + */ + if (!(xid.type == ID_TYPE_GID || xid.type == ID_TYPE_BOTH)) { + tevent_req_nterror(req, NT_STATUS_NONE_MAPPED); + return; + } + + state->gid = (gid_t)xid.id; + subreq = wb_group_members_send(state, state->ev, &state->sid, state->type, state->max_nesting); if (tevent_req_nomem(subreq, req)) { -- cgit