31
31
static void wb_next_pwent_fetch_done(struct tevent_req *subreq);
32
32
static void wb_next_pwent_fill_done(struct tevent_req *subreq);
34
static struct winbindd_domain *wb_next_find_domain(struct winbindd_domain *domain)
37
domain = domain_list();
39
domain = domain->next;
43
&& sid_check_is_domain(&domain->sid)) {
44
domain = domain->next;
34
54
struct tevent_req *wb_next_pwent_send(TALLOC_CTX *mem_ctx,
35
55
struct tevent_context *ev,
36
56
struct getpwent_state *gstate,
50
70
if (state->gstate->next_user >= state->gstate->num_users) {
51
71
TALLOC_FREE(state->gstate->users);
53
if (state->gstate->domain == NULL) {
54
state->gstate->domain = domain_list();
56
state->gstate->domain = state->gstate->domain->next;
59
if ((state->gstate->domain != NULL)
60
&& sid_check_is_domain(&state->gstate->domain->sid)) {
61
state->gstate->domain = state->gstate->domain->next;
73
state->gstate->domain = wb_next_find_domain(state->gstate->domain);
64
74
if (state->gstate->domain == NULL) {
65
75
tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES);
66
76
return tevent_req_post(req, ev);
149
159
status = wb_fill_pwent_recv(subreq);
150
160
TALLOC_FREE(subreq);
151
if (tevent_req_nterror(req, status)) {
162
* When you try to enumerate users with 'getent passwd' and the user
163
* doesn't have a uid set we should just move on.
165
if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
166
state->gstate->next_user += 1;
168
if (state->gstate->next_user >= state->gstate->num_users) {
169
TALLOC_FREE(state->gstate->users);
171
state->gstate->domain = wb_next_find_domain(state->gstate->domain);
172
if (state->gstate->domain == NULL) {
173
tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES);
177
subreq = wb_query_user_list_send(state, state->ev,
178
state->gstate->domain);
179
if (tevent_req_nomem(subreq, req)) {
182
tevent_req_set_callback(subreq, wb_next_pwent_fetch_done, req);
186
subreq = wb_fill_pwent_send(state,
188
&state->gstate->users[state->gstate->next_user],
190
if (tevent_req_nomem(subreq, req)) {
193
tevent_req_set_callback(subreq, wb_next_pwent_fill_done, req);
196
} else if (tevent_req_nterror(req, status)) {
154
199
state->gstate->next_user += 1;