mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
winbindd: Use idmap cache in xids2sids
Typically smbd should have looked into the idmap cache itself before contacting winbind. But winbind has internal users of this API (getpwuid and getgrgid for example), and those need to use the cache too. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12484 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org> Autobuild-User(master): Uri Simchoni <uri@samba.org> Autobuild-Date(master): Wed Dec 28 00:06:41 CET 2016 on sn-devel-144
This commit is contained in:
parent
f7f49a2354
commit
91d027554e
@ -353,6 +353,32 @@ struct tevent_req *wb_xids2sids_send(TALLOC_CTX *mem_ctx,
|
|||||||
return tevent_req_post(req, ev);
|
return tevent_req_post(req, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (winbindd_use_idmap_cache()) {
|
||||||
|
uint32_t i;
|
||||||
|
|
||||||
|
for (i=0; i<num_xids; i++) {
|
||||||
|
struct dom_sid sid;
|
||||||
|
bool ok, expired;
|
||||||
|
|
||||||
|
switch (xids[i].type) {
|
||||||
|
case ID_TYPE_UID:
|
||||||
|
ok = idmap_cache_find_uid2sid(
|
||||||
|
xids[i].id, &sid, &expired);
|
||||||
|
break;
|
||||||
|
case ID_TYPE_GID:
|
||||||
|
ok = idmap_cache_find_gid2sid(
|
||||||
|
xids[i].id, &sid, &expired);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok && !expired) {
|
||||||
|
sid_copy(&state->sids[i], &sid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wb_xids2sids_init_dom_maps();
|
wb_xids2sids_init_dom_maps();
|
||||||
num_domains = talloc_array_length(dom_maps);
|
num_domains = talloc_array_length(dom_maps);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user