From b6931cdc578cf69f081e07a681ffdcb2e096c402 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 3 Jan 2012 16:55:25 +0100 Subject: [PATCH] s3-winbind: Fix segfault if we can't map the last user. This fixes bug #8678. The issue is caused by bug #8608. Autobuild-User: Andreas Schneider Autobuild-Date: Wed Jan 4 18:30:53 CET 2012 on sn-devel-104 (cherry picked from commit b9d208bdaa9da2a5ae534481865efc881b851b01) (cherry picked from commit 23db6e7cf65bdd3974a4857dda0be6ad7d758b9a) (cherry picked from commit b16104ddf431d81f673bc3cf5e998c0f9421f2e9) --- source3/winbindd/wb_next_pwent.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source3/winbindd/wb_next_pwent.c b/source3/winbindd/wb_next_pwent.c index e5b5e299bfb..0970ce75fdb 100644 --- a/source3/winbindd/wb_next_pwent.c +++ b/source3/winbindd/wb_next_pwent.c @@ -154,6 +154,24 @@ static void wb_next_pwent_fill_done(struct tevent_req *subreq) if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) { state->gstate->next_user += 1; + if (state->gstate->next_user >= state->gstate->num_users) { + TALLOC_FREE(state->gstate->users); + + state->gstate->domain = wb_next_find_domain(state->gstate->domain); + if (state->gstate->domain == NULL) { + tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES); + return; + } + + subreq = wb_query_user_list_send(state, state->ev, + state->gstate->domain); + if (tevent_req_nomem(subreq, req)) { + return; + } + tevent_req_set_callback(subreq, wb_next_pwent_fetch_done, req); + return; + } + subreq = wb_fill_pwent_send(state, state->ev, &state->gstate->users[state->gstate->next_user], -- 2.11.4.GIT