diff options
author | Michael Adam <obnox@samba.org> | 2015-01-19 13:51:55 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2015-03-16 20:26:50 +0100 |
commit | 24015224da1f363019d9d2da81ce533463a16abb (patch) | |
tree | b74574e5927c45c60666d90547c363428780d2d6 | |
parent | 3d1e4a90d0a890a20fea6b39ae96e6a7e34d4b79 (diff) | |
download | samba-24015224da1f363019d9d2da81ce533463a16abb.tar.gz |
s3:winbind:grent: don't stop group enumeration when a group has no gid
simply continue with the next group
Note: this patch introduces some code duplication to make it
easier to create minimal backport patch. Subsequent patches
will provide some refactoring to reduce the duplication.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=8905
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
-rw-r--r-- | source3/winbindd/wb_next_grent.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/source3/winbindd/wb_next_grent.c b/source3/winbindd/wb_next_grent.c index aea134bafe9..58e161d9857 100644 --- a/source3/winbindd/wb_next_grent.c +++ b/source3/winbindd/wb_next_grent.c @@ -168,9 +168,58 @@ static void wb_next_grent_getgrsid_done(struct tevent_req *subreq) status = wb_getgrsid_recv(subreq, talloc_tos(), &domname, &name, &state->gr->gr_gid, &state->members); TALLOC_FREE(subreq); - if (tevent_req_nterror(req, status)) { + + if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) { + state->gstate->next_group += 1; + + if (state->gstate->next_group >= state->gstate->num_groups) { + TALLOC_FREE(state->gstate->groups); + + if (state->gstate->domain == NULL) { + state->gstate->domain = domain_list(); + } else { + state->gstate->domain = state->gstate->domain->next; + } + + if ((state->gstate->domain != NULL) && + sid_check_is_our_sam(&state->gstate->domain->sid)) + { + state->gstate->domain = state->gstate->domain->next; + } + + if (state->gstate->domain == NULL) { + tevent_req_nterror(req, + NT_STATUS_NO_MORE_ENTRIES); + return; + } + + subreq = dcerpc_wbint_QueryGroupList_send( + state, state->ev, + dom_child_handle(state->gstate->domain), + &state->next_groups); + if (tevent_req_nomem(subreq, req)) { + return; + } + + tevent_req_set_callback(subreq, + wb_next_grent_fetch_done, req); + return; + } + + subreq = wb_getgrsid_send( + state, state->ev, + &state->gstate->groups[state->gstate->next_group].sid, + state->max_nesting); + if (tevent_req_nomem(subreq, req)) { + return; + } + tevent_req_set_callback(subreq, wb_next_grent_getgrsid_done, + req); + return; + } else if (tevent_req_nterror(req, status)) { return; } + if (!fill_grent(talloc_tos(), state->gr, domname, name, state->gr->gr_gid)) { DEBUG(5, ("fill_grent failed\n")); |