summaryrefslogtreecommitdiff
path: root/source3/winbindd/wb_next_pwent.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2012-01-03 16:55:25 +0100
committerAndreas Schneider <asn@cryptomilk.org>2012-01-04 18:30:52 +0100
commitb9d208bdaa9da2a5ae534481865efc881b851b01 (patch)
tree6b49c47b80b911b4cd94575a15abf07cc23832d3 /source3/winbindd/wb_next_pwent.c
parent5075e565684627dfbd23f715da344b4365351ccb (diff)
downloadsamba-b9d208bdaa9da2a5ae534481865efc881b851b01.tar.gz
samba-b9d208bdaa9da2a5ae534481865efc881b851b01.tar.bz2
samba-b9d208bdaa9da2a5ae534481865efc881b851b01.zip
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 <asn@cryptomilk.org> Autobuild-Date: Wed Jan 4 18:30:53 CET 2012 on sn-devel-104
Diffstat (limited to 'source3/winbindd/wb_next_pwent.c')
-rw-r--r--source3/winbindd/wb_next_pwent.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source3/winbindd/wb_next_pwent.c b/source3/winbindd/wb_next_pwent.c
index 998830952b..8104568d7a 100644
--- a/source3/winbindd/wb_next_pwent.c
+++ b/source3/winbindd/wb_next_pwent.c
@@ -165,6 +165,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],