diff options
author | Jeremy Allison <jra@samba.org> | 2000-12-12 02:45:11 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-12-12 02:45:11 +0000 |
commit | 20ac3fc77e9423ab13a2cc1a2ef3d266f5b233e0 (patch) | |
tree | e3d55ebe50dda9d3368993b5664facf3c1b268be /source3/rpc_server | |
parent | 276364e2a4cee00f4521845347a0b0a371f6b0e6 (diff) | |
download | samba-20ac3fc77e9423ab13a2cc1a2ef3d266f5b233e0.tar.gz samba-20ac3fc77e9423ab13a2cc1a2ef3d266f5b233e0.tar.bz2 samba-20ac3fc77e9423ab13a2cc1a2ef3d266f5b233e0.zip |
Merged in Tim's changes : Removed static limit of MAX_LOOKUP_SIDS in rpc server and client
lsa_lookup_names() and lsa_lookup_sids().
Jeremy.
(This used to be commit 9e9c71c8b3194b7cd02fea0b6a000d4f2940d905)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_lsa.c | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c index 7e6417f276..38f4936209 100644 --- a/source3/rpc_server/srv_lsa.c +++ b/source3/rpc_server/srv_lsa.c @@ -277,13 +277,26 @@ static void init_reply_lookup_names(LSA_R_LOOKUP_NAMES *r_l, ***************************************************************************/ static void init_lsa_trans_names(DOM_R_REF *ref, LSA_TRANS_NAME_ENUM *trn, - int num_entries, DOM_SID2 sid[MAX_LOOKUP_SIDS], uint32 *mapped_count) + int num_entries, DOM_SID2 *sid, + uint32 *mapped_count) { int i; int total = 0; *mapped_count = 0; - SMB_ASSERT(num_entries <= MAX_LOOKUP_SIDS); + /* Allocate memory for list of names */ + + if (!(trn->name = (LSA_TRANS_NAME *)malloc(sizeof(LSA_TRANS_NAME) * + num_entries))) { + DEBUG(0, ("init_lsa_trans_names(): out of memory\n")); + return; + } + + if (!(trn->uni_name = (UNISTR2 *)malloc(sizeof(UNISTR2) * + num_entries))) { + DEBUG(0, ("init_lsa_trans_names(): out of memory\n")); + return; + } for (i = 0; i < num_entries; i++) { BOOL status = False; @@ -318,7 +331,8 @@ static void init_lsa_trans_names(DOM_R_REF *ref, LSA_TRANS_NAME_ENUM *trn, dom_idx = init_dom_ref(ref, dom_name, &find_sid); - DEBUG(10,("init_lsa_trans_names: added user '%s\\%s' to referenced list.\n", dom_name, name )); + DEBUG(10,("init_lsa_trans_names: added user '%s\\%s' to " + "referenced list.\n", dom_name, name )); (*mapped_count)++; @@ -376,6 +390,11 @@ static BOOL lsa_reply_lookup_sids(prs_struct *rdata, DOM_SID2 *sid, int num_entr return False; } + /* Free memory - perhaps this should be done using talloc()? */ + + safe_free(names.name); + safe_free(names.uni_name); + return True; } @@ -551,20 +570,29 @@ static BOOL api_lsa_lookup_sids(pipes_struct *p) LSA_Q_LOOKUP_SIDS q_l; prs_struct *data = &p->in_data.data; prs_struct *rdata = &p->out_data.rdata; + BOOL result = True; ZERO_STRUCT(q_l); /* grab the info class and policy handle */ if(!lsa_io_q_lookup_sids("", &q_l, data, 0)) { DEBUG(0,("api_lsa_lookup_sids: failed to unmarshall LSA_Q_LOOKUP_SIDS.\n")); - return False; + result = False; + goto done; } /* construct reply. return status is always 0x0 */ - if(!lsa_reply_lookup_sids(rdata, q_l.sids.sid, q_l.sids.num_entries)) - return False; + if(!lsa_reply_lookup_sids(rdata, q_l.sids.sid, q_l.sids.num_entries)) { + result = False; + goto done; + } - return True; + + done: + safe_free(q_l.sids.ptr_sid); + safe_free(q_l.sids.sid); + + return result; } /*************************************************************************** |