diff options
author | Volker Lendecke <vl@samba.org> | 2019-03-11 16:55:57 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-03-12 00:42:19 +0000 |
commit | e18610a197aab80a32cae8c1e09b96496679bbad (patch) | |
tree | 2868943bc213731d1c8c6ff4afbb1120bf35873d /libcli/security | |
parent | a27c39c2c9fd3161f5bf3ae5dba687c8d49519ef (diff) | |
download | samba-e18610a197aab80a32cae8c1e09b96496679bbad.tar.gz |
lib: Make sid_parse return the parsed length
Use a temporary struct as a return value to make the compiler catch all
callers. If we just changed bool->ssize_t, this would just generate a
warning. struct sid_parse_ret will go away in the next commit
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'libcli/security')
-rw-r--r-- | libcli/security/dom_sid.h | 4 | ||||
-rw-r--r-- | libcli/security/util_sid.c | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/libcli/security/dom_sid.h b/libcli/security/dom_sid.h index abaf305f96a..bc66280291b 100644 --- a/libcli/security/dom_sid.h +++ b/libcli/security/dom_sid.h @@ -112,7 +112,9 @@ bool sid_split_rid(struct dom_sid *sid, uint32_t *rid); bool sid_peek_rid(const struct dom_sid *sid, uint32_t *rid); bool sid_peek_check_rid(const struct dom_sid *exp_dom_sid, const struct dom_sid *sid, uint32_t *rid); void sid_copy(struct dom_sid *dst, const struct dom_sid *src); -bool sid_parse(const uint8_t *inbuf, size_t len, struct dom_sid *sid); +struct sid_parse_ret { ssize_t len; }; +struct sid_parse_ret sid_parse( + const uint8_t *inbuf, size_t len, struct dom_sid *sid); int sid_compare_domain(const struct dom_sid *sid1, const struct dom_sid *sid2); NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const struct dom_sid *sid, struct dom_sid **sids, uint32_t *num); diff --git a/libcli/security/util_sid.c b/libcli/security/util_sid.c index 531d3809565..4a186d69cda 100644 --- a/libcli/security/util_sid.c +++ b/libcli/security/util_sid.c @@ -300,7 +300,8 @@ void sid_copy(struct dom_sid *dst, const struct dom_sid *src) Parse a on-the-wire SID to a struct dom_sid. *****************************************************************/ -bool sid_parse(const uint8_t *inbuf, size_t len, struct dom_sid *sid) +struct sid_parse_ret sid_parse( + const uint8_t *inbuf, size_t len, struct dom_sid *sid) { DATA_BLOB in = data_blob_const(inbuf, len); enum ndr_err_code ndr_err; @@ -308,9 +309,9 @@ bool sid_parse(const uint8_t *inbuf, size_t len, struct dom_sid *sid) ndr_err = ndr_pull_struct_blob_all( &in, NULL, sid, (ndr_pull_flags_fn_t)ndr_pull_dom_sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - return false; + return (struct sid_parse_ret) { .len = -1 }; } - return true; + return (struct sid_parse_ret) { .len = ndr_size_dom_sid(sid, 0) }; } /***************************************************************** |