From 63db0694c45b1ce59b9232f0690226fce39f9c28 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Wed, 31 Jul 2013 10:38:23 -0400 Subject: torture: add LOCAL-sid_to_string testcase Signed-off-by: Jeff Layton Reviewed-by: Jeremy Allison --- source3/torture/torture.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'source3/torture') diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 25561e230d..b0b498f1fe 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -8497,6 +8497,35 @@ static bool run_local_string_to_sid(int dummy) { return true; } +static bool sid_to_string_test(char *expected) { + char *str; + bool res = true; + struct dom_sid sid; + + if (!string_to_sid(&sid, expected)) { + printf("could not parse %s\n", expected); + return false; + } + + str = dom_sid_string(NULL, &sid); + if (strcmp(str, expected)) { + printf("Comparison failed (%s != %s)\n", str, expected); + res = false; + } + TALLOC_FREE(str); + return res; +} + +static bool run_local_sid_to_string(int dummy) { + if (!sid_to_string_test("S-1-0xffffffffffff-1-1-1-1-1-1-1-1-1-1-1-1")) + return false; + if (!sid_to_string_test("S-1-545")) + return false; + if (!sid_to_string_test("S-255-3840-1-1-1-1")) + return false; + return true; +} + static bool run_local_binary_to_sid(int dummy) { struct dom_sid *sid = talloc(NULL, struct dom_sid); static const char good_binary_sid[] = { @@ -9538,6 +9567,7 @@ static struct { { "LOCAL-STREAM-NAME", run_local_stream_name, 0}, { "LOCAL-WBCLIENT", run_local_wbclient, 0}, { "LOCAL-string_to_sid", run_local_string_to_sid, 0}, + { "LOCAL-sid_to_string", run_local_sid_to_string, 0}, { "LOCAL-binary_to_sid", run_local_binary_to_sid, 0}, { "LOCAL-DBTRANS", run_local_dbtrans, 0}, { "LOCAL-TEVENT-SELECT", run_local_tevent_select, 0}, -- cgit