From f62219e71af69ec8b331500b75fd5fd77d51a636 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 26 Jul 2013 11:31:41 +0200 Subject: s3:winbind: fix gid counting and error handling in the getgroups implementation Pair-Programmed-With: Stefan Metzmacher Signed-off-by: Michael Adam Signed-off-by: Stefan Metzmacher --- source3/winbindd/winbindd_getgroups.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source3/winbindd/winbindd_getgroups.c b/source3/winbindd/winbindd_getgroups.c index 1774901903..bed8877cab 100644 --- a/source3/winbindd/winbindd_getgroups.c +++ b/source3/winbindd/winbindd_getgroups.c @@ -156,18 +156,22 @@ static void winbindd_getgroups_sid2gid_done(struct tevent_req *subreq) status = wb_sids2xids_recv(subreq, &xid); TALLOC_FREE(subreq); + if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED) || + NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) + { + status = NT_STATUS_OK; + } + if (tevent_req_nterror(req, status)) { + return; + } + if (xid.type == ID_TYPE_GID || xid.type == ID_TYPE_BOTH) { state->gids[state->num_gids] = (gid_t)xid.id; + state->num_gids += 1; } else { state->gids[state->num_gids] = (uid_t)-1; } - /* - * In case of failure, just continue with the next gid - */ - if (NT_STATUS_IS_OK(status)) { - state->num_gids += 1; - } state->next_sid += 1; if (state->next_sid >= state->num_sids) { -- cgit