summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2019-02-21 16:55:09 +0100
committerKarolin Seeger <kseeger@samba.org>2019-03-05 07:39:28 +0000
commit89c3db2e9bbb39d3665db0f2eecd62f253771199 (patch)
tree0f00f157905c7b327a1e902d450c8d01c2101de5
parent29e16f4737c6e955a18bc1130d06dcf17b7cb0d1 (diff)
downloadsamba-89c3db2e9bbb39d3665db0f2eecd62f253771199.tar.gz
winbindd: set idmap cache entries as the last step in async wb_xids2sids
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> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Sat Feb 23 09:23:22 CET 2019 on sn-devel-144 (cherry picked from commit 9b9565c3e69b92c298c7168e516387bb249c9e36)
-rw-r--r--source3/winbindd/wb_xids2sids.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/source3/winbindd/wb_xids2sids.c b/source3/winbindd/wb_xids2sids.c
index dcbbe8d510d..1e251d8cbeb 100644
--- a/source3/winbindd/wb_xids2sids.c
+++ b/source3/winbindd/wb_xids2sids.c
@@ -368,17 +368,6 @@ static void wb_xids2sids_dom_done(struct tevent_req *subreq)
sid_copy(&state->all_sids[i], &state->dom_sids[dom_sid_idx]);
*id = state->dom_xids[dom_sid_idx];
- /*
- * Prime the cache after an xid2sid call. It's
- * important that we use state->dom_xids for the xid
- * value, not state->all_xids: state->all_xids carries
- * what we asked for, e.g. a
- * ID_TYPE_UID. state->dom_xids holds something the
- * idmap child possibly changed to ID_TYPE_BOTH.
- */
- idmap_cache_set_sid2unixid(
- &state->all_sids[i], &state->dom_xids[dom_sid_idx]);
-
dom_sid_idx += 1;
}
@@ -543,6 +532,7 @@ static void wb_xids2sids_done(struct tevent_req *subreq)
struct wb_xids2sids_state *state = tevent_req_data(
req, struct wb_xids2sids_state);
size_t num_domains = talloc_array_length(dom_maps);
+ size_t i;
NTSTATUS status;
status = wb_xids2sids_dom_recv(subreq);
@@ -567,6 +557,27 @@ static void wb_xids2sids_done(struct tevent_req *subreq)
return;
}
+
+ for (i = 0; i < state->num_xids; i++) {
+ /*
+ * Prime the cache after an xid2sid call. It's important that we
+ * use the xid value returned from the backend for the xid value
+ * passed to idmap_cache_set_sid2unixid(), not the input to
+ * wb_xids2sids_send: the input carries what was asked for,
+ * e.g. a ID_TYPE_UID. The result from the backend something the
+ * idmap child possibly changed to ID_TYPE_BOTH.
+ *
+ * And of course If the value was from the cache don't update
+ * the cache.
+ */
+
+ if (state->cached[i]) {
+ continue;
+ }
+
+ idmap_cache_set_sid2unixid(&state->sids[i], &state->xids[i]);
+ }
+
tevent_req_done(req);
return;
}