summaryrefslogtreecommitdiff
path: root/source4/torture/unix
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2019-03-11 16:55:57 +0100
committerAndrew Bartlett <abartlet@samba.org>2019-03-12 00:42:19 +0000
commite18610a197aab80a32cae8c1e09b96496679bbad (patch)
tree2868943bc213731d1c8c6ff4afbb1120bf35873d /source4/torture/unix
parenta27c39c2c9fd3161f5bf3ae5dba687c8d49519ef (diff)
downloadsamba-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 'source4/torture/unix')
-rw-r--r--source4/torture/unix/whoami.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/source4/torture/unix/whoami.c b/source4/torture/unix/whoami.c
index efd9efaab57..f554c9e1711 100644
--- a/source4/torture/unix/whoami.c
+++ b/source4/torture/unix/whoami.c
@@ -303,11 +303,13 @@ static bool test_against_ldap(struct torture_context *torture, struct ldb_contex
for (i = 0; i < el->num_values; i++) {
struct dom_sid *sid = talloc(torture, struct dom_sid);
+ struct sid_parse_ret ret;
torture_assert(torture, sid != NULL, "talloc failed");
-
+
+ ret = sid_parse(el->values[i].data,
+ el->values[i].length, sid);
torture_assert(torture,
- sid_parse(el->values[i].data,
- el->values[i].length, sid),
+ ret.len != -1,
"sid parse failed");
torture_assert_str_equal(torture, dom_sid_string(sid, sid), dom_sid_string(sid, whoami->sid_list[i]), "SID from LDAP and SID from CIFS does not match!");
talloc_free(sid);
@@ -318,20 +320,24 @@ static bool test_against_ldap(struct torture_context *torture, struct ldb_contex
struct dom_sid *dom_sid = talloc(torture, struct dom_sid);
struct dom_sid *dc_sids = talloc_array(torture, struct dom_sid, el->num_values);
struct dom_sid *member_sids = talloc_array(torture, struct dom_sid, whoami->num_sids);
+ struct sid_parse_ret ret;
torture_assert(torture, user_sid != NULL, "talloc failed");
- torture_assert(torture, sid_parse(el->values[0].data,
- el->values[0].length,
- user_sid),
+ ret = sid_parse(el->values[0].data,
+ el->values[0].length,
+ user_sid);
+ torture_assert(torture,
+ ret.len != -1,
"sid parse failed");
torture_assert_ntstatus_equal(torture, dom_sid_split_rid(torture, user_sid, &dom_sid, NULL), NT_STATUS_OK, "failed to split domain SID from user SID");
for (i = 0; i < el->num_values; i++) {
struct dom_sid *sid = talloc(dc_sids, struct dom_sid);
torture_assert(torture, sid != NULL, "talloc failed");
-
+
+ ret = sid_parse(el->values[i].data,
+ el->values[i].length,
+ sid);
torture_assert(torture,
- sid_parse(el->values[i].data,
- el->values[i].length,
- sid),
+ ret.len != -1,
"sid parse failed");
if (dom_sid_in_domain(dom_sid, sid)) {
dc_sids[num_domain_sids_dc] = *sid;