diff options
Diffstat (limited to 'source4/libcli/util/dom_sid.c')
-rw-r--r-- | source4/libcli/util/dom_sid.c | 13 |
1 files changed, 7 insertions, 6 deletions
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;i<num_sub_auths;i++) { - ret->sub_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; |