summaryrefslogtreecommitdiff
path: root/libcli/security
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
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')
-rw-r--r--libcli/security/dom_sid.c14
-rw-r--r--libcli/security/dom_sid.h2
2 files changed, 14 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);
}
/*
diff --git a/libcli/security/dom_sid.h b/libcli/security/dom_sid.h
index 3493fab838..04571c21de 100644
--- a/libcli/security/dom_sid.h
+++ b/libcli/security/dom_sid.h
@@ -60,6 +60,8 @@ int dom_sid_compare_domain(const struct dom_sid *sid1,
bool dom_sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2);
bool sid_append_rid(struct dom_sid *sid, uint32_t rid);
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);
bool dom_sid_parse(const char *sidstr, struct dom_sid *ret);
struct dom_sid *dom_sid_parse_talloc(TALLOC_CTX *mem_ctx, const char *sidstr);
struct dom_sid *dom_sid_parse_length(TALLOC_CTX *mem_ctx, const DATA_BLOB *sid);