uint32 ptr_dom_ref;
DOM_R_REF *dom_ref; /* domain reference info */
- LSA_TRANS_NAME_ENUM *names;
+ LSA_TRANS_NAME_ENUM names;
uint32 mapped_count;
NTSTATUS status; /* return code */
uint32 ptr_dom_ref;
DOM_R_REF *dom_ref; /* domain reference info */
- LSA_TRANS_NAME_ENUM2 *names;
+ LSA_TRANS_NAME_ENUM2 names;
uint32 mapped_count;
NTSTATUS status; /* return code */
uint32 ptr_dom_ref;
DOM_R_REF *dom_ref; /* domain reference info */
- LSA_TRANS_NAME_ENUM2 *names;
+ LSA_TRANS_NAME_ENUM2 names;
uint32 mapped_count;
NTSTATUS status; /* return code */
LSA_Q_LOOKUP_SIDS q;
LSA_R_LOOKUP_SIDS r;
DOM_R_REF ref;
- LSA_TRANS_NAME_ENUM t_names;
NTSTATUS result = NT_STATUS_OK;
TALLOC_CTX *tmp_ctx = NULL;
int i;
init_q_lookup_sids(tmp_ctx, &q, pol, num_sids, sids, 1);
ZERO_STRUCT(ref);
- ZERO_STRUCT(t_names);
r.dom_ref = &ref;
- r.names = &t_names;
CLI_DO_RPC( cli, tmp_ctx, PI_LSARPC, LSA_LOOKUPSIDS,
q, r,
for (i = 0; i < num_sids; i++) {
fstring name, dom_name;
- uint32 dom_idx = t_names.name[i].domain_idx;
+ uint32 dom_idx = r.names.name[i].domain_idx;
/* Translate optimised name through domain index array */
rpcstr_pull_unistr2_fstring(
dom_name, &ref.ref_dom[dom_idx].uni_dom_name);
rpcstr_pull_unistr2_fstring(
- name, &t_names.uni_name[i]);
+ name, &r.names.uni_name[i]);
(names)[i] = talloc_strdup(mem_ctx, name);
(domains)[i] = talloc_strdup(mem_ctx, dom_name);
- (types)[i] = (enum lsa_SidType)t_names.name[i].sid_name_use;
+ (types)[i] = (enum lsa_SidType)r.names.name[i].sid_name_use;
if (((names)[i] == NULL) || ((domains)[i] == NULL)) {
- DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
+ DEBUG(0, ("cli_lsa_lookup_sids_noalloc(): out of memory\n"));
result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
LSA_Q_LOOKUP_SIDS q;
LSA_R_LOOKUP_SIDS r;
DOM_R_REF ref;
- LSA_TRANS_NAME_ENUM t_names;
NTSTATUS result = NT_STATUS_OK;
int i;
init_q_lookup_sids(mem_ctx, &q, pol, num_sids, sids, 1);
ZERO_STRUCT(ref);
- ZERO_STRUCT(t_names);
r.dom_ref = &ref;
- r.names = &t_names;
CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_LOOKUPSIDS,
q, r,
for (i = 0; i < num_sids; i++) {
fstring name, dom_name;
- uint32 dom_idx = t_names.name[i].domain_idx;
+ uint32 dom_idx = r.names.name[i].domain_idx;
/* Translate optimised name through domain index array */
rpcstr_pull_unistr2_fstring(
dom_name, &ref.ref_dom[dom_idx].uni_dom_name);
rpcstr_pull_unistr2_fstring(
- name, &t_names.uni_name[i]);
+ name, &r.names.uni_name[i]);
(*names)[i] = talloc_strdup(mem_ctx, name);
(*domains)[i] = talloc_strdup(mem_ctx, dom_name);
- (*types)[i] = (enum lsa_SidType)t_names.name[i].sid_name_use;
+ (*types)[i] = (enum lsa_SidType)r.names.name[i].sid_name_use;
if (((*names)[i] == NULL) || ((*domains)[i] == NULL)) {
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
if(!lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth)) /* domain reference info */
return False;
- if(!lsa_io_trans_names("names ", r_s->names, ps, depth)) /* translated names */
+ if(!lsa_io_trans_names("names ", &r_s->names, ps, depth)) /* translated names */
return False;
if(!prs_align(ps))
if(!lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth)) /* domain reference info */
return False;
- if(!lsa_io_trans_names2("names ", r_s->names, ps, depth)) /* translated names */
+ if(!lsa_io_trans_names2("names ", &r_s->names, ps, depth)) /* translated names */
return False;
if(!prs_align(ps))
if(!lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth)) /* domain reference info */
return False;
- if(!lsa_io_trans_names2("names ", r_s->names, ps, depth)) /* translated names */
+ if(!lsa_io_trans_names2("names ", &r_s->names, ps, depth)) /* translated names */
return False;
if(!prs_align(ps))
static void init_reply_lookup_sids2(LSA_R_LOOKUP_SIDS2 *r_l,
DOM_R_REF *ref,
- LSA_TRANS_NAME_ENUM2 *names,
uint32 mapped_count)
{
r_l->ptr_dom_ref = ref ? 1 : 0;
r_l->dom_ref = ref;
- r_l->names = names;
r_l->mapped_count = mapped_count;
}
static void init_reply_lookup_sids3(LSA_R_LOOKUP_SIDS3 *r_l,
DOM_R_REF *ref,
- LSA_TRANS_NAME_ENUM2 *names,
uint32 mapped_count)
{
r_l->ptr_dom_ref = ref ? 1 : 0;
r_l->dom_ref = ref;
- r_l->names = names;
r_l->mapped_count = mapped_count;
}
LSA_TRANS_NAME_ENUM2 *names,
uint32 mapped_count)
{
- LSA_TRANS_NAME_ENUM *oldnames = TALLOC_ZERO_P(mem_ctx, LSA_TRANS_NAME_ENUM);
-
- if (!oldnames) {
- return NT_STATUS_NO_MEMORY;
- }
+ LSA_TRANS_NAME_ENUM *oldnames = &r_l->names;
oldnames->num_entries = names->num_entries;
oldnames->ptr_trans_names = names->ptr_trans_names;
r_l->ptr_dom_ref = ref ? 1 : 0;
r_l->dom_ref = ref;
- r_l->names = oldnames;
r_l->mapped_count = mapped_count;
return NT_STATUS_OK;
}
int num_sids, /* input */
const DOM_SID2 *sid, /* input */
DOM_R_REF **pp_ref, /* output */
- LSA_TRANS_NAME_ENUM2 **pp_names, /* output */
+ LSA_TRANS_NAME_ENUM2 *names, /* input/output */
uint32 *pp_mapped_count)
{
NTSTATUS status;
int i;
const DOM_SID **sids = NULL;
- LSA_TRANS_NAME_ENUM2 *names = NULL;
DOM_R_REF *ref = NULL;
uint32 mapped_count = 0;
struct lsa_dom_info *dom_infos = NULL;
*pp_mapped_count = 0;
*pp_ref = NULL;
- *pp_names = NULL;
+ ZERO_STRUCTP(names);
if (num_sids == 0) {
return NT_STATUS_OK;
}
- names = TALLOC_ZERO_P(p->mem_ctx, LSA_TRANS_NAME_ENUM2);
sids = TALLOC_ARRAY(p->mem_ctx, const DOM_SID *, num_sids);
ref = TALLOC_ZERO_P(p->mem_ctx, DOM_R_REF);
- if (sids == NULL || names == NULL || ref == NULL) {
+ if (sids == NULL || ref == NULL) {
return NT_STATUS_NO_MEMORY;
}
*pp_mapped_count = mapped_count;
*pp_ref = ref;
- *pp_names = names;
return status;
}
int num_sids = q_u->sids.num_entries;
uint32 mapped_count = 0;
DOM_R_REF *ref = NULL;
- LSA_TRANS_NAME_ENUM2 *names = NULL;
+ LSA_TRANS_NAME_ENUM2 names;
NTSTATUS status;
if ((q_u->level < 1) || (q_u->level > 6)) {
/* Convert from LSA_TRANS_NAME_ENUM2 to LSA_TRANS_NAME_ENUM */
- status = init_reply_lookup_sids(p->mem_ctx, r_u, ref, names, mapped_count);
+ status = init_reply_lookup_sids(p->mem_ctx, r_u, ref, &names, mapped_count);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
int num_sids = q_u->sids.num_entries;
uint32 mapped_count = 0;
DOM_R_REF *ref = NULL;
- LSA_TRANS_NAME_ENUM2 *names = NULL;
if ((q_u->level < 1) || (q_u->level > 6)) {
return NT_STATUS_INVALID_PARAMETER;
num_sids,
q_u->sids.sid,
&ref,
- &names,
+ &r_u->names,
&mapped_count);
- init_reply_lookup_sids2(r_u, ref, names, mapped_count);
+ init_reply_lookup_sids2(r_u, ref, mapped_count);
return r_u->status;
}
{
uint32 mapped_count = 0;
DOM_R_REF *ref;
- LSA_TRANS_NAME_ENUM2 *names;
if ((q_u->level < 1) || (q_u->level > 6)) {
return NT_STATUS_INVALID_PARAMETER;
r_u->status = NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED;
ref = TALLOC_ZERO_P(p->mem_ctx, DOM_R_REF);
- names = TALLOC_ZERO_P(p->mem_ctx, LSA_TRANS_NAME_ENUM2);
- if ((ref == NULL) || (names == NULL)) {
+ if (ref == NULL) {
/* We would segfault later on in lsa_io_r_lookup_sids3 anyway,
* so do a planned exit here. We NEEEED pidl! */
smb_panic("talloc failed");
}
- init_reply_lookup_sids3(r_u, ref, names, mapped_count);
+ init_reply_lookup_sids3(r_u, ref, mapped_count);
return r_u->status;
}