1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-04 17:47:26 +03:00

init_dom_sid2s: Check return code from string_to_sid. Skip tokens

that are not valid SIDs.
(This used to be commit 5a597272782b74d28859ba98027fe9ff9c278086)
This commit is contained in:
Martin Pool 2003-02-18 01:30:22 +00:00
parent 5511347b8d
commit 49c3018cbc

View File

@ -873,10 +873,12 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsi
int number; int number;
DOM_SID2 *sids; DOM_SID2 *sids;
/* Count the number of SIDs. */ /* Count the number of valid SIDs. */
for (count = 0, ptr = sids_str; for (count = 0, ptr = sids_str; next_token(&ptr, s2, NULL, sizeof(s2)); ) {
next_token(&ptr, s2, NULL, sizeof(s2)); count++) DOM_SID tmpsid;
; if (string_to_sid(&tmpsid, s2))
count++;
}
/* Now allocate space for them. */ /* Now allocate space for them. */
*ppsids = (DOM_SID2 *)talloc_zero(ctx, count * sizeof(DOM_SID2)); *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; sids = *ppsids;
for (number = 0, ptr = sids_str; for (number = 0, ptr = sids_str; next_token(&ptr, s2, NULL, sizeof(s2)); ) {
next_token(&ptr, s2, NULL, sizeof(s2)); number++) {
DOM_SID tmpsid; DOM_SID tmpsid;
string_to_sid(&tmpsid, s2); if (string_to_sid(&tmpsid, s2)) {
init_dom_sid2(&sids[number], &tmpsid); /* count only valid sids */
init_dom_sid2(&sids[number], &tmpsid);
number++;
}
} }
} }