diff options
Diffstat (limited to 'source4/winbind')
-rw-r--r-- | source4/winbind/wb_async_helpers.c | 21 | ||||
-rw-r--r-- | source4/winbind/wb_init_domain.c | 7 |
2 files changed, 23 insertions, 5 deletions
diff --git a/source4/winbind/wb_async_helpers.c b/source4/winbind/wb_async_helpers.c index 25d52a16b5..48a2a4d882 100644 --- a/source4/winbind/wb_async_helpers.c +++ b/source4/winbind/wb_async_helpers.c @@ -41,6 +41,7 @@ struct lsa_lookupsids_state { struct lsa_LookupSids r; struct lsa_SidArray sids; struct lsa_TransNameArray names; + struct lsa_RefDomainList *domains; uint32_t count; struct wb_sid_object **result; }; @@ -76,6 +77,9 @@ struct composite_context *wb_lsa_lookupsids_send(TALLOC_CTX *mem_ctx, if (state->sids.sids[i].sid == NULL) goto failed; } + state->domains = talloc(state, struct lsa_RefDomainList); + if (state->domains == NULL) goto failed; + state->count = 0; state->num_sids = num_sids; state->names.count = 0; @@ -88,6 +92,7 @@ struct composite_context *wb_lsa_lookupsids_send(TALLOC_CTX *mem_ctx, state->r.in.count = &state->count; state->r.out.names = &state->names; state->r.out.count = &state->count; + state->r.out.domains = &state->domains; req = dcerpc_lsa_LookupSids_send(lsa_pipe, state, &state->r); if (req == NULL) goto failed; @@ -125,6 +130,8 @@ static void lsa_lookupsids_recv_names(struct rpc_request *req) struct lsa_TranslatedName *name = &state->r.out.names->names[i]; struct lsa_DomainInfo *dom; + struct lsa_RefDomainList *domains = + state->domains; state->result[i] = talloc_zero(state->result, struct wb_sid_object); @@ -135,13 +142,13 @@ static void lsa_lookupsids_recv_names(struct rpc_request *req) continue; } - if (name->sid_index >= state->r.out.domains->count) { + if (name->sid_index >= domains->count) { composite_error(state->ctx, NT_STATUS_INVALID_PARAMETER); return; } - dom = &state->r.out.domains->domains[name->sid_index]; + dom = &domains->domains[name->sid_index]; state->result[i]->domain = talloc_reference(state->result[i], dom->name.string); if ((name->sid_type == SID_NAME_DOMAIN) || @@ -183,6 +190,7 @@ struct lsa_lookupnames_state { uint32_t num_names; struct lsa_LookupNames r; struct lsa_TransSidArray sids; + struct lsa_RefDomainList *domains; uint32_t count; struct wb_sid_object **result; }; @@ -222,6 +230,9 @@ struct composite_context *wb_lsa_lookupnames_send(TALLOC_CTX *mem_ctx, lsa_names[i].string = names[i]; } + state->domains = talloc(state, struct lsa_RefDomainList); + if (state->domains == NULL) goto failed; + state->r.in.handle = handle; state->r.in.num_names = num_names; state->r.in.names = lsa_names; @@ -230,6 +241,7 @@ struct composite_context *wb_lsa_lookupnames_send(TALLOC_CTX *mem_ctx, state->r.in.count = &state->count; state->r.out.count = &state->count; state->r.out.sids = &state->sids; + state->r.out.domains = &state->domains; req = dcerpc_lsa_LookupNames_send(lsa_pipe, state, &state->r); if (req == NULL) goto failed; @@ -265,6 +277,7 @@ static void lsa_lookupnames_recv_sids(struct rpc_request *req) for (i=0; i<state->num_names; i++) { struct lsa_TranslatedSid *sid = &state->r.out.sids->sids[i]; + struct lsa_RefDomainList *domains = state->domains; struct lsa_DomainInfo *dom; state->result[i] = talloc_zero(state->result, @@ -276,13 +289,13 @@ static void lsa_lookupnames_recv_sids(struct rpc_request *req) continue; } - if (sid->sid_index >= state->r.out.domains->count) { + if (sid->sid_index >= domains->count) { composite_error(state->ctx, NT_STATUS_INVALID_PARAMETER); return; } - dom = &state->r.out.domains->domains[sid->sid_index]; + dom = &domains->domains[sid->sid_index]; state->result[i]->sid = dom_sid_add_rid(state->result[i], dom->sid, sid->rid); diff --git a/source4/winbind/wb_init_domain.c b/source4/winbind/wb_init_domain.c index c6dee825a9..531647def8 100644 --- a/source4/winbind/wb_init_domain.c +++ b/source4/winbind/wb_init_domain.c @@ -70,6 +70,7 @@ struct init_domain_state { struct lsa_ObjectAttribute objectattr; struct lsa_OpenPolicy2 lsa_openpolicy; struct lsa_QueryInfoPolicy queryinfo; + union lsa_PolicyInformation *info; }; static void init_domain_recv_netlogonpipe(struct composite_context *ctx); @@ -326,8 +327,12 @@ static void init_domain_recv_lsa_policy(struct rpc_request *req) state->ctx->status = state->lsa_openpolicy.out.result; if (!composite_is_ok(state->ctx)) return; + state->info = talloc_zero(state->ctx, union lsa_PolicyInformation); + if (composite_nomem(state->info, state->ctx)) return; + state->queryinfo.in.handle = &state->domain->libnet_ctx->lsa.handle; state->queryinfo.in.level = LSA_POLICY_INFO_ACCOUNT_DOMAIN; + state->queryinfo.out.info = &state->info; req = dcerpc_lsa_QueryInfoPolicy_send(state->domain->libnet_ctx->lsa.pipe, state, &state->queryinfo); @@ -347,7 +352,7 @@ static void init_domain_recv_queryinfo(struct rpc_request *req) state->ctx->status = state->queryinfo.out.result; if (!composite_is_ok(state->ctx)) return; - dominfo = &state->queryinfo.out.info->account_domain; + dominfo = &(*state->queryinfo.out.info)->account_domain; if (strcasecmp(state->domain->info->name, dominfo->name.string) != 0) { DEBUG(2, ("Expected domain name %s, DC %s said %s\n", |