summaryrefslogtreecommitdiff
path: root/source4/libcli/util
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-04-18 03:57:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:18 -0500
commitb9411f8aca7d3619551adaa09cd632cb507a6c7c (patch)
tree95c8e15b1fd73c28a3d908ed1139735cecaa9d13 /source4/libcli/util
parent3441f077166ec6c6df0d9eaf337cde2e75643fbe (diff)
downloadsamba-b9411f8aca7d3619551adaa09cd632cb507a6c7c.tar.gz
samba-b9411f8aca7d3619551adaa09cd632cb507a6c7c.tar.bz2
samba-b9411f8aca7d3619551adaa09cd632cb507a6c7c.zip
r265: fixed a bug in the string to sid conversion code
(This used to be commit 117aa5cab7783ea741d4840ea5ced00cf34868a3)
Diffstat (limited to 'source4/libcli/util')
-rw-r--r--source4/libcli/util/dom_sid.c13
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;