From: Stefan Metzmacher Date: Mon, 6 Mar 2017 09:30:52 +0000 (+0100) Subject: winbindd: find the domain based on the sid within wb_lookupusergroups_send() X-Git-Tag: tdb-1.3.13~646 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=76d94838049b77555cdf7dad2d15692cb18b4dab;p=thirdparty%2Fsamba.git winbindd: find the domain based on the sid within wb_lookupusergroups_send() That simplifies the potential caller. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12612 Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/winbindd/wb_lookupusergroups.c b/source3/winbindd/wb_lookupusergroups.c index 2d3969236fa..7647fbd5e66 100644 --- a/source3/winbindd/wb_lookupusergroups.c +++ b/source3/winbindd/wb_lookupusergroups.c @@ -32,11 +32,11 @@ static void wb_lookupusergroups_done(struct tevent_req *subreq); struct tevent_req *wb_lookupusergroups_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct winbindd_domain *domain, const struct dom_sid *sid) { struct tevent_req *req, *subreq; struct wb_lookupusergroups_state *state; + struct winbindd_domain *domain; NTSTATUS status; req = tevent_req_create(mem_ctx, &state, @@ -55,6 +55,15 @@ struct tevent_req *wb_lookupusergroups_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } + domain = find_domain_from_sid_noinit(&state->sid); + if (domain == NULL) { + char buf[DOM_SID_STR_BUFLEN]; + dom_sid_string_buf(&state->sid, buf, sizeof(buf)); + DEBUG(1,("could not find domain entry for sid %s\n", buf)); + tevent_req_nterror(req, NT_STATUS_NO_SUCH_DOMAIN); + return tevent_req_post(req, ev); + } + subreq = dcerpc_wbint_LookupUserGroups_send( state, ev, dom_child_handle(domain), &state->sid, &state->sids); if (tevent_req_nomem(subreq, req)) { diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index 0faf0c6a763..46fb60038e6 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -665,7 +665,6 @@ NTSTATUS winbindd_getsidaliases_recv(struct tevent_req *req, struct winbindd_response *response); struct tevent_req *wb_lookupusergroups_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct winbindd_domain *domain, const struct dom_sid *sid); NTSTATUS wb_lookupusergroups_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, int *num_sids, struct dom_sid **sids);