diff options
author | Martin Pool <mbp@samba.org> | 2003-02-18 01:30:22 +0000 |
---|---|---|
committer | Martin Pool <mbp@samba.org> | 2003-02-18 01:30:22 +0000 |
commit | 49c3018cbc5e85d5c492d20263edffd0f1bc7246 (patch) | |
tree | 028874e6e20e51a8f28c7b47dd798e1cc735a43f /source3/rpc_parse/parse_net.c | |
parent | 5511347b8d5a974d5cd0536eded92c4b77c1091d (diff) | |
download | samba-49c3018cbc5e85d5c492d20263edffd0f1bc7246.tar.gz samba-49c3018cbc5e85d5c492d20263edffd0f1bc7246.tar.bz2 samba-49c3018cbc5e85d5c492d20263edffd0f1bc7246.zip |
init_dom_sid2s: Check return code from string_to_sid. Skip tokens
that are not valid SIDs.
(This used to be commit 5a597272782b74d28859ba98027fe9ff9c278086)
Diffstat (limited to 'source3/rpc_parse/parse_net.c')
-rw-r--r-- | source3/rpc_parse/parse_net.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 1e31836476..53f660fcc3 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -873,10 +873,12 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsi int number; DOM_SID2 *sids; - /* Count the number of SIDs. */ - for (count = 0, ptr = sids_str; - next_token(&ptr, s2, NULL, sizeof(s2)); count++) - ; + /* Count the number of valid SIDs. */ + for (count = 0, ptr = sids_str; next_token(&ptr, s2, NULL, sizeof(s2)); ) { + DOM_SID tmpsid; + if (string_to_sid(&tmpsid, s2)) + count++; + } /* Now allocate space for them. */ *ppsids = (DOM_SID2 *)talloc_zero(ctx, count * sizeof(DOM_SID2)); @@ -885,11 +887,13 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsi sids = *ppsids; - for (number = 0, ptr = sids_str; - next_token(&ptr, s2, NULL, sizeof(s2)); number++) { + for (number = 0, ptr = sids_str; next_token(&ptr, s2, NULL, sizeof(s2)); ) { DOM_SID tmpsid; - string_to_sid(&tmpsid, s2); - init_dom_sid2(&sids[number], &tmpsid); + if (string_to_sid(&tmpsid, s2)) { + /* count only valid sids */ + init_dom_sid2(&sids[number], &tmpsid); + number++; + } } } |