wb_sids2xids: move more checks to wb_sids2xids_next_sids2unix()
authorStefan Metzmacher <metze@samba.org>
Tue, 15 Sep 2020 11:19:14 +0000 (13:19 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 23 Oct 2020 03:25:36 +0000 (03:25 +0000)
For the first run this is a no-op, but it simplified the caller.

We'll call wb_sids2xids_next_sids2unix() in a few more places in future
and it's easier to have this all within wb_sids2xids_next_sids2unix().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14539

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source3/winbindd/wb_sids2xids.c

index 2a30eee2c7b1fa71e739be3580b4b1060a72f201..b934425f4fd65a26e10e93835b8710486e315c0f 100644 (file)
@@ -309,6 +309,13 @@ static void wb_sids2xids_next_sids2unix(struct tevent_req *req)
        struct tevent_req *subreq = NULL;
        struct dcerpc_binding_handle *child_binding_handle = NULL;
 
+       state->tried_dclookup = false;
+
+       if (state->dom_index == state->idmap_doms.count) {
+               tevent_req_done(req);
+               return;
+       }
+
        state->dom_ids = wb_sids2xids_extract_for_domain_index(
                state, &state->ids, state->dom_index);
        if (tevent_req_nomem(state->dom_ids, req)) {
@@ -413,12 +420,6 @@ static void wb_sids2xids_done(struct tevent_req *subreq)
        TALLOC_FREE(state->dom_ids);
 
        state->dom_index += 1;
-       state->tried_dclookup = false;
-
-       if (state->dom_index == state->idmap_doms.count) {
-               tevent_req_done(req);
-               return;
-       }
 
        wb_sids2xids_next_sids2unix(req);
 }