1 From 7f0edd8c68cd20a136a33d692f32ee2ffc30db76 Mon Sep 17 00:00:00 2001
2 From: Michael Adam <obnox@samba.org>
3 Date: Mon, 19 Jan 2015 13:51:55 +0100
4 Subject: [PATCH] s3:winbind:grent: don't stop group enumeration when a group
7 simply continue with the next group
9 Note: this patch introduces some code duplication to make it
10 easier to create minimal backport patch. Subsequent patches
11 will provide some refactoring to reduce the duplication.
13 BUG: https://bugzilla.samba.org/show_bug.cgi?id=8905
15 Signed-off-by: Michael Adam <obnox@samba.org>
17 source3/winbindd/wb_next_grent.c | 51 +++++++++++++++++++++++++++++++++++++++-
18 1 file changed, 50 insertions(+), 1 deletion(-)
20 diff --git a/source3/winbindd/wb_next_grent.c b/source3/winbindd/wb_next_grent.c
21 index 2b3799a..f52d2d1 100644
22 --- a/source3/winbindd/wb_next_grent.c
23 +++ b/source3/winbindd/wb_next_grent.c
24 @@ -168,9 +168,58 @@ static void wb_next_grent_getgrsid_done(struct tevent_req *subreq)
25 status = wb_getgrsid_recv(subreq, talloc_tos(), &domname, &name,
26 &state->gr->gr_gid, &state->members);
28 - if (tevent_req_nterror(req, status)) {
30 + if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
31 + state->gstate->next_group += 1;
33 + if (state->gstate->next_group >= state->gstate->num_groups) {
34 + TALLOC_FREE(state->gstate->groups);
36 + if (state->gstate->domain == NULL) {
37 + state->gstate->domain = domain_list();
39 + state->gstate->domain = state->gstate->domain->next;
42 + if ((state->gstate->domain != NULL) &&
43 + sid_check_is_domain(&state->gstate->domain->sid))
45 + state->gstate->domain = state->gstate->domain->next;
48 + if (state->gstate->domain == NULL) {
49 + tevent_req_nterror(req,
50 + NT_STATUS_NO_MORE_ENTRIES);
54 + subreq = dcerpc_wbint_QueryGroupList_send(
56 + dom_child_handle(state->gstate->domain),
57 + &state->next_groups);
58 + if (tevent_req_nomem(subreq, req)) {
62 + tevent_req_set_callback(subreq,
63 + wb_next_grent_fetch_done, req);
67 + subreq = wb_getgrsid_send(
69 + &state->gstate->groups[state->gstate->next_group].sid,
70 + state->max_nesting);
71 + if (tevent_req_nomem(subreq, req)) {
74 + tevent_req_set_callback(subreq, wb_next_grent_getgrsid_done,
77 + } else if (tevent_req_nterror(req, status)) {
81 if (!fill_grent(talloc_tos(), state->gr, domname, name,
83 DEBUG(5, ("fill_grent failed\n"));