winbind: Now we explicitly track if we got ids from cache
authorVolker Lendecke <vl@samba.org>
Mon, 25 Feb 2019 13:55:00 +0000 (14:55 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 12 Mar 2019 11:25:42 +0000 (11:25 +0000)
This now properly makes us use negative cache entries

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813
(cherry picked from commit 95d33ca79cc315f1a2e41cd60859ef01d6548c77)

source3/winbindd/wb_xids2sids.c

index 5be55d59b75927203ea47f268a2097ddef8a382c..55c24822925dfb4b7ace93527ccae33af3363452 100644 (file)
@@ -243,6 +243,7 @@ static NTSTATUS wb_xids2sids_init_dom_maps_recv(struct tevent_req *req)
 struct wb_xids2sids_dom_state {
        struct tevent_context *ev;
        struct unixid *all_xids;
+       const bool *cached;
        size_t num_all_xids;
        struct dom_sid *all_sids;
        struct wb_xids2sids_dom_map *dom_map;
@@ -259,7 +260,10 @@ static void wb_xids2sids_dom_gotdc(struct tevent_req *subreq);
 static struct tevent_req *wb_xids2sids_dom_send(
        TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        struct wb_xids2sids_dom_map *dom_map,
-       struct unixid *xids, size_t num_xids, struct dom_sid *sids)
+       struct unixid *xids,
+       const bool *cached,
+       size_t num_xids,
+       struct dom_sid *sids)
 {
        struct tevent_req *req, *subreq;
        struct wb_xids2sids_dom_state *state;
@@ -273,6 +277,7 @@ static struct tevent_req *wb_xids2sids_dom_send(
        }
        state->ev = ev;
        state->all_xids = xids;
+       state->cached = cached;
        state->num_all_xids = num_xids;
        state->all_sids = sids;
        state->dom_map = dom_map;
@@ -293,7 +298,7 @@ static struct tevent_req *wb_xids2sids_dom_send(
                        /* out of range */
                        continue;
                }
-               if (!is_null_sid(&state->all_sids[i])) {
+               if (state->cached[i]) {
                        /* already mapped */
                        continue;
                }
@@ -360,7 +365,7 @@ static void wb_xids2sids_dom_done(struct tevent_req *subreq)
                        /* out of range */
                        continue;
                }
-               if (!is_null_sid(&state->all_sids[i])) {
+               if (state->cached[i]) {
                        /* already mapped */
                        continue;
                }
@@ -517,7 +522,7 @@ static void wb_xids2sids_init_dom_maps_done(struct tevent_req *subreq)
 
        subreq = wb_xids2sids_dom_send(
                state, state->ev, &dom_maps[state->dom_idx],
-               state->xids, state->num_xids, state->sids);
+               state->xids, state->cached, state->num_xids, state->sids);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -548,6 +553,7 @@ static void wb_xids2sids_done(struct tevent_req *subreq)
                                               state->ev,
                                               &dom_maps[state->dom_idx],
                                               state->xids,
+                                              state->cached,
                                               state->num_xids,
                                               state->sids);
                if (tevent_req_nomem(subreq, req)) {