From: Volker Lendecke Date: Tue, 3 Jan 2017 14:54:46 +0000 (+0000) Subject: winbind: Add "expand_local_aliases" to wb_gettoken X-Git-Tag: samba-4.6.0rc1~19 X-Git-Url: http://git.samba.org/samba.git/?a=commitdiff_plain;h=bb050bfd88e34c9d922ac2c26ab4cefc1bd07543;p=nivanova%2Fsamba-autobuild%2F.git winbind: Add "expand_local_aliases" to wb_gettoken I hate passing down booleans, but we have the "domain_groups_only" parameter in wbcLookupUserSids which we need to keep for API compatibility. To make sure we use as few code paths as possible, this basically passes down this flag. Signed-off-by: Volker Lendecke Reviewed-by: Uri Simchoni Reviewed-by: Andreas Schneider --- diff --git a/source3/winbindd/wb_gettoken.c b/source3/winbindd/wb_gettoken.c index 1c99121bb09..d8867c36b9d 100644 --- a/source3/winbindd/wb_gettoken.c +++ b/source3/winbindd/wb_gettoken.c @@ -26,6 +26,7 @@ struct wb_gettoken_state { struct tevent_context *ev; struct dom_sid usersid; + bool expand_local_aliases; int num_sids; struct dom_sid *sids; }; @@ -41,7 +42,8 @@ static void wb_gettoken_gotbuiltins(struct tevent_req *subreq); struct tevent_req *wb_gettoken_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - const struct dom_sid *sid) + const struct dom_sid *sid, + bool expand_local_aliases) { struct tevent_req *req, *subreq; struct wb_gettoken_state *state; @@ -52,6 +54,7 @@ struct tevent_req *wb_gettoken_send(TALLOC_CTX *mem_ctx, } sid_copy(&state->usersid, sid); state->ev = ev; + state->expand_local_aliases = expand_local_aliases; subreq = wb_queryuser_send(state, ev, &state->usersid); if (tevent_req_nomem(subreq, req)) { @@ -115,6 +118,11 @@ static void wb_gettoken_gotuser(struct tevent_req *subreq) num_groups * sizeof(struct dom_sid)); state->num_sids += num_groups; + if (!state->expand_local_aliases) { + tevent_req_done(req); + return; + } + /* * Expand our domain's aliases */ diff --git a/source3/winbindd/winbindd_getgroups.c b/source3/winbindd/winbindd_getgroups.c index 8b9d0a3ecdf..8bf670654e1 100644 --- a/source3/winbindd/winbindd_getgroups.c +++ b/source3/winbindd/winbindd_getgroups.c @@ -99,7 +99,7 @@ static void winbindd_getgroups_lookupname_done(struct tevent_req *subreq) return; } - subreq = wb_gettoken_send(state, state->ev, &state->sid); + subreq = wb_gettoken_send(state, state->ev, &state->sid, true); if (tevent_req_nomem(subreq, req)) { return; } diff --git a/source3/winbindd/winbindd_getusersids.c b/source3/winbindd/winbindd_getusersids.c index 6b5510ad5a5..d6995c4390a 100644 --- a/source3/winbindd/winbindd_getusersids.c +++ b/source3/winbindd/winbindd_getusersids.c @@ -55,7 +55,7 @@ struct tevent_req *winbindd_getusersids_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - subreq = wb_gettoken_send(state, ev, &state->sid); + subreq = wb_gettoken_send(state, ev, &state->sid, true); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index a4e05187d32..2aed8dc25aa 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -687,7 +687,8 @@ NTSTATUS winbindd_getuserdomgroups_recv(struct tevent_req *req, struct winbindd_response *response); struct tevent_req *wb_gettoken_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - const struct dom_sid *sid); + const struct dom_sid *sid, + bool expand_local_aliases); NTSTATUS wb_gettoken_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, int *num_sids, struct dom_sid **sids); struct tevent_req *winbindd_getgroups_send(TALLOC_CTX *mem_ctx,