summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeff Layton <jlayton@samba.org>2013-07-31 10:38:23 -0400
committerJeremy Allison <jra@samba.org>2013-07-31 15:16:18 -0700
commit63db0694c45b1ce59b9232f0690226fce39f9c28 (patch)
treed97083a44f3e18d6d7880173efb10a20d4fe47af /source3
parent1a21bc04830958a8058d7304921c836edd63586e (diff)
downloadsamba-63db0694c45b1ce59b9232f0690226fce39f9c28.tar.gz
samba-63db0694c45b1ce59b9232f0690226fce39f9c28.tar.bz2
samba-63db0694c45b1ce59b9232f0690226fce39f9c28.zip
torture: add LOCAL-sid_to_string testcase
Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/selftest/tests.py1
-rw-r--r--source3/torture/torture.c30
2 files changed, 31 insertions, 0 deletions
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 3fc6684665..afab6872a0 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -99,6 +99,7 @@ local_tests = [
"LOCAL-STREAM-NAME",
"LOCAL-WBCLIENT",
"LOCAL-string_to_sid",
+ "LOCAL-sid_to_string",
"LOCAL-binary_to_sid",
"LOCAL-DBTRANS",
"LOCAL-TEVENT-SELECT",
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},