summaryrefslogtreecommitdiff
path: root/libcli/security/dom_sid.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-03-07 20:16:13 +0100
committerJeremy Allison <jra@samba.org>2011-04-13 14:13:24 -0700
commitd4c693df98835444d1db242b2723617d2e231c6a (patch)
treec3b2072d3daaa72e456df35628eac02ae36ff2df /libcli/security/dom_sid.c
parentdf269c0834a46bb0f0cf44d0f0822c05c8c797a5 (diff)
downloadsamba-d4c693df98835444d1db242b2723617d2e231c6a.tar.gz
samba-d4c693df98835444d1db242b2723617d2e231c6a.tar.bz2
samba-d4c693df98835444d1db242b2723617d2e231c6a.zip
Add dom_sid_parse_endp
This returns a pointer to the first non-parsed character, along the lines of strtoul for example. Signed-off-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'libcli/security/dom_sid.c')
-rw-r--r--libcli/security/dom_sid.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/libcli/security/dom_sid.c b/libcli/security/dom_sid.c
index 809f20ce26..2f80a36ae1 100644
--- a/libcli/security/dom_sid.c
+++ b/libcli/security/dom_sid.c
@@ -118,9 +118,11 @@ int dom_sid_compare_domain(const struct dom_sid *sid1,
/*****************************************************************
Convert a string to a SID. Returns True on success, False on fail.
+ Return the first character not parsed in endp.
*****************************************************************/
-bool string_to_sid(struct dom_sid *sidout, const char *sidstr)
+bool dom_sid_parse_endp(const char *sidstr,struct dom_sid *sidout,
+ const char **endp)
{
const char *p;
char *q;
@@ -197,6 +199,9 @@ bool string_to_sid(struct dom_sid *sidout, const char *sidstr)
}
q += 1;
}
+ if (endp != NULL) {
+ *endp = q;
+ }
return true;
format_error:
@@ -204,9 +209,14 @@ format_error:
return false;
}
+bool string_to_sid(struct dom_sid *sidout, const char *sidstr)
+{
+ return dom_sid_parse(sidstr, sidout);
+}
+
bool dom_sid_parse(const char *sidstr, struct dom_sid *ret)
{
- return string_to_sid(ret, sidstr);
+ return dom_sid_parse_endp(sidstr, ret, NULL);
}
/*