winbindd: make a copy of xid's in wb_xids2sids_send()
authorRalph Boehme <slow@samba.org>
Thu, 21 Feb 2019 17:34:51 +0000 (18:34 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 23 Feb 2019 06:54:09 +0000 (07:54 +0100)
This is in preparation of setting the result of the mapping in the top-
level callback wb_xids2sids_done(), not in the per-idmap-domain callback
wb_xids2sids_dom_done().

When caching the mapping we need the id-type from the backend, so we
need a way to pass up that information from wb_xids2sids_dom_done() up
to wb_xids2sids_done()

The xids array copy gets passed from wb_xids2sids_send() to
wb_xids2sids_dom_send(), so wb_xids2sids_dom_done() can then directly
update the top-level copy.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13802

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/winbindd/wb_xids2sids.c

index 310a645cdff01f5ecb42351d78a2152303b345b3..38e581eee8d88d335fe93f31e9a7e40332cb5bd9 100644 (file)
@@ -452,9 +452,14 @@ struct tevent_req *wb_xids2sids_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
        state->ev = ev;
-       state->xids = xids;
        state->num_xids = num_xids;
 
+       state->xids = talloc_array(state, struct unixid, num_xids);
+       if (tevent_req_nomem(state->xids, req)) {
+               return tevent_req_post(req, ev);
+       }
+       memcpy(state->xids, xids, num_xids * sizeof(struct unixid));
+
        state->sids = talloc_zero_array(state, struct dom_sid, num_xids);
        if (tevent_req_nomem(state->sids, req)) {
                return tevent_req_post(req, ev);