diff options
-rw-r--r-- | libcli/security/dom_sid.c | 14 | ||||
-rw-r--r-- | libcli/security/dom_sid.h | 2 |
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); |