diff options
author | Günther Deschner <gd@samba.org> | 2008-02-13 00:02:21 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-02-13 00:29:20 +0100 |
commit | f57c67b8f3e75a9aa50c24ff892b12b530de6a38 (patch) | |
tree | bfafa19f9806078410103bb4d540fd8fb3019ad9 /source3 | |
parent | ba934cc6c1ba48b8d6d976876ae023e6b5b4c1bb (diff) | |
download | samba-f57c67b8f3e75a9aa50c24ff892b12b530de6a38.tar.gz samba-f57c67b8f3e75a9aa50c24ff892b12b530de6a38.tar.bz2 samba-f57c67b8f3e75a9aa50c24ff892b12b530de6a38.zip |
Use pidl for _lsa_EnumTrustDom()
Guenther
(This used to be commit 1f45079907d03116b48b55d616281ed4359a66d8)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpc_server/srv_lsa.c | 21 | ||||
-rw-r--r-- | source3/rpc_server/srv_lsa_nt.c | 52 |
2 files changed, 31 insertions, 42 deletions
diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c index 9865a70e72..f48a397f1d 100644 --- a/source3/rpc_server/srv_lsa.c +++ b/source3/rpc_server/srv_lsa.c @@ -70,26 +70,7 @@ static bool api_lsa_open_policy(pipes_struct *p) static bool api_lsa_enum_trust_dom(pipes_struct *p) { - LSA_Q_ENUM_TRUST_DOM q_u; - LSA_R_ENUM_TRUST_DOM r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - /* grab the enum trust domain context etc. */ - if(!lsa_io_q_enum_trust_dom("", &q_u, data, 0)) - return False; - - /* get required trusted domains information */ - r_u.status = _lsa_enum_trust_dom(p, &q_u, &r_u); - - /* prepare the response */ - if(!lsa_io_r_enum_trust_dom("", &r_u, rdata, 0)) - return False; - - return True; + return proxy_lsa_call(p, NDR_LSA_ENUMTRUSTDOM); } /*************************************************************************** diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c index 8041424627..3cf83962ee 100644 --- a/source3/rpc_server/srv_lsa_nt.c +++ b/source3/rpc_server/srv_lsa_nt.c @@ -592,16 +592,18 @@ NTSTATUS _lsa_OpenPolicy(pipes_struct *p, } /*************************************************************************** - _lsa_enum_trust_dom - this needs fixing to do more than return NULL ! JRA. + _lsa_EnumTrustDom - this needs fixing to do more than return NULL ! JRA. ufff, done :) mimir ***************************************************************************/ -NTSTATUS _lsa_enum_trust_dom(pipes_struct *p, LSA_Q_ENUM_TRUST_DOM *q_u, - LSA_R_ENUM_TRUST_DOM *r_u) +NTSTATUS _lsa_EnumTrustDom(pipes_struct *p, + struct lsa_EnumTrustDom *r) { struct lsa_info *info; uint32 next_idx; struct trustdom_info **domains; + struct lsa_DomainInfo *lsa_domains = NULL; + int i; /* * preferred length is set to 5 as a "our" preferred length @@ -610,12 +612,12 @@ NTSTATUS _lsa_enum_trust_dom(pipes_struct *p, LSA_Q_ENUM_TRUST_DOM *q_u, * it needs further investigation how to optimally choose this value */ uint32 max_num_domains = - q_u->preferred_len < 5 ? q_u->preferred_len : 10; + r->in.max_size < 5 ? r->in.max_size : 10; uint32 num_domains; NTSTATUS nt_status; uint32 num_thistime; - if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info)) + if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info)) return NT_STATUS_INVALID_HANDLE; /* check if the user have enough rights */ @@ -628,29 +630,41 @@ NTSTATUS _lsa_enum_trust_dom(pipes_struct *p, LSA_Q_ENUM_TRUST_DOM *q_u, return nt_status; } - if (q_u->enum_context < num_domains) { + if (*r->in.resume_handle < num_domains) { num_thistime = MIN(num_domains, max_num_domains); - r_u->status = STATUS_MORE_ENTRIES; + nt_status = STATUS_MORE_ENTRIES; - if (q_u->enum_context + num_thistime > num_domains) { - num_thistime = num_domains - q_u->enum_context; - r_u->status = NT_STATUS_OK; + if (*r->in.resume_handle + num_thistime > num_domains) { + num_thistime = num_domains - *r->in.resume_handle; + nt_status = NT_STATUS_OK; } - next_idx = q_u->enum_context + num_thistime; + next_idx = *r->in.resume_handle + num_thistime; } else { num_thistime = 0; next_idx = 0xffffffff; - r_u->status = NT_STATUS_NO_MORE_ENTRIES; + nt_status = NT_STATUS_NO_MORE_ENTRIES; } - + /* set up the lsa_enum_trust_dom response */ - init_r_enum_trust_dom(p->mem_ctx, r_u, next_idx, - num_thistime, domains+q_u->enum_context); + lsa_domains = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_DomainInfo, + num_thistime); + if (!lsa_domains) { + return NT_STATUS_NO_MEMORY; + } - return r_u->status; + for (i=0; i<num_thistime; i++) { + init_lsa_StringLarge(&lsa_domains[i].name, domains[i]->name); + lsa_domains[i].sid = &domains[i]->sid; + } + + *r->out.resume_handle = next_idx; + r->out.domains->count = num_thistime; + r->out.domains->domains = lsa_domains; + + return nt_status; } /*************************************************************************** @@ -2222,12 +2236,6 @@ NTSTATUS _lsa_EnumAccounts(pipes_struct *p, struct lsa_EnumAccounts *r) return NT_STATUS_NOT_IMPLEMENTED; } -NTSTATUS _lsa_EnumTrustDom(pipes_struct *p, struct lsa_EnumTrustDom *r) -{ - p->rng_fault_state = True; - return NT_STATUS_NOT_IMPLEMENTED; -} - NTSTATUS _lsa_LookupNames(pipes_struct *p, struct lsa_LookupNames *r) { p->rng_fault_state = True; |