s3:winbind:grent: use wb_next_domain() in wb_next_grent.c
authorMichael Adam <obnox@samba.org>
Tue, 20 Jan 2015 09:25:37 +0000 (10:25 +0100)
committerGünther Deschner <gd@samba.org>
Mon, 16 Mar 2015 19:26:51 +0000 (20:26 +0100)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/winbindd/wb_next_grent.c

index 02f929ac2f5ff34ee23a86068de87f7fa1051f83..108be3516651d09740d97a280054d69a4b6aae89 100644 (file)
@@ -55,17 +55,7 @@ struct tevent_req *wb_next_grent_send(TALLOC_CTX *mem_ctx,
        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;
-               }
-
+               state->gstate->domain = wb_next_domain(state->gstate->domain);
                if (state->gstate->domain == NULL) {
                        tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES);
                        return tevent_req_post(req, ev);
@@ -122,13 +112,7 @@ static void wb_next_grent_fetch_done(struct tevent_req *subreq)
                state->gstate, &state->next_groups.principals);
 
        if (state->gstate->num_groups == 0) {
-               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;
-               }
-
+               state->gstate->domain = wb_next_domain(state->gstate->domain);
                if (state->gstate->domain == NULL) {
                        tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES);
                        return;
@@ -175,18 +159,8 @@ static void wb_next_grent_getgrsid_done(struct tevent_req *subreq)
                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;
-                       }
 
+                       state->gstate->domain = wb_next_domain(state->gstate->domain);
                        if (state->gstate->domain == NULL) {
                                tevent_req_nterror(req,
                                                   NT_STATUS_NO_MORE_ENTRIES);