1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

winbind: Slightly simplify wb_sids2xids

We only needs "names" and "domains" wb_sids2xids_lookupsids_done. It confused
me when reading this code that these variables are stored in "state".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2015-01-23 13:32:45 +00:00 committed by Jeremy Allison
parent c6577f3043
commit 200d0bc3a8

View File

@ -36,9 +36,6 @@ struct wb_sids2xids_state {
struct dom_sid *non_cached; struct dom_sid *non_cached;
uint32_t num_non_cached; uint32_t num_non_cached;
struct lsa_RefDomainList *domains;
struct lsa_TransNameArray *names;
/* /*
* Domain array to use for the idmap call. The output from * Domain array to use for the idmap call. The output from
* lookupsids cannot be used directly since for migrated * lookupsids cannot be used directly since for migrated
@ -158,12 +155,13 @@ static void wb_sids2xids_lookupsids_done(struct tevent_req *subreq)
subreq, struct tevent_req); subreq, struct tevent_req);
struct wb_sids2xids_state *state = tevent_req_data( struct wb_sids2xids_state *state = tevent_req_data(
req, struct wb_sids2xids_state); req, struct wb_sids2xids_state);
struct lsa_RefDomainList *domains = NULL;
struct lsa_TransNameArray *names = NULL;
struct winbindd_child *child; struct winbindd_child *child;
NTSTATUS status; NTSTATUS status;
int i; int i;
status = wb_lookupsids_recv(subreq, state, &state->domains, status = wb_lookupsids_recv(subreq, state, &domains, &names);
&state->names);
TALLOC_FREE(subreq); TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) { if (tevent_req_nterror(req, status)) {
return; return;
@ -184,13 +182,13 @@ static void wb_sids2xids_lookupsids_done(struct tevent_req *subreq)
for (i=0; i<state->num_non_cached; i++) { for (i=0; i<state->num_non_cached; i++) {
struct dom_sid dom_sid; struct dom_sid dom_sid;
struct lsa_DomainInfo *info; struct lsa_DomainInfo *info;
struct lsa_TranslatedName *n = &state->names->names[i]; struct lsa_TranslatedName *n = &names->names[i];
struct wbint_TransID *t = &state->ids.ids[i]; struct wbint_TransID *t = &state->ids.ids[i];
sid_copy(&dom_sid, &state->non_cached[i]); sid_copy(&dom_sid, &state->non_cached[i]);
sid_split_rid(&dom_sid, &t->rid); sid_split_rid(&dom_sid, &t->rid);
info = &state->domains->domains[n->sid_index]; info = &domains->domains[n->sid_index];
t->type = lsa_SidType_to_id_type(n->sid_type); t->type = lsa_SidType_to_id_type(n->sid_type);
t->domain_index = init_lsa_ref_domain_list(state, t->domain_index = init_lsa_ref_domain_list(state,
state->idmap_doms, state->idmap_doms,
@ -200,6 +198,9 @@ static void wb_sids2xids_lookupsids_done(struct tevent_req *subreq)
t->xid.type = t->type; t->xid.type = t->type;
} }
TALLOC_FREE(names);
TALLOC_FREE(domains);
child = idmap_child(); child = idmap_child();
subreq = dcerpc_wbint_Sids2UnixIDs_send( subreq = dcerpc_wbint_Sids2UnixIDs_send(