From b9411f8aca7d3619551adaa09cd632cb507a6c7c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 18 Apr 2004 03:57:09 +0000 Subject: r265: fixed a bug in the string to sid conversion code (This used to be commit 117aa5cab7783ea741d4840ea5ced00cf34868a3) --- source4/libcli/util/dom_sid.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source4') diff --git a/source4/libcli/util/dom_sid.c b/source4/libcli/util/dom_sid.c index 652f17a6b6..dbc9c20155 100644 --- a/source4/libcli/util/dom_sid.c +++ b/source4/libcli/util/dom_sid.c @@ -44,10 +44,10 @@ struct dom_sid *dom_sid_parse_talloc(TALLOC_CTX *mem_ctx, const char *sidstr) sidstr = p+1; ia = strtol(sidstr, &p, 10); - if (*p != '-') { + if (p == sidstr) { return NULL; } - sidstr = p+1; + sidstr = p; num_sub_auths = 0; for (i=0;sidstr[i];i++) { @@ -75,14 +75,15 @@ struct dom_sid *dom_sid_parse_talloc(TALLOC_CTX *mem_ctx, const char *sidstr) ret->num_auths = num_sub_auths; for (i=0;isub_auths[i] = strtol(sidstr, &p, 10); - if (p == sidstr) { + if (sidstr[0] != '-') { return NULL; } - if (*p != '-' && i < num_sub_auths-1) { + sidstr++; + ret->sub_auths[i] = strtol(sidstr, &p, 10); + if (p == sidstr) { return NULL; } - sidstr = p+1; + sidstr = p; } return ret; -- cgit