diff options
author | Günther Deschner <gd@samba.org> | 2009-05-11 16:28:42 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-05-11 16:44:39 +0200 |
commit | 5f015920a80a22f5486e0679f017db3a5ff9d798 (patch) | |
tree | e7b4cacf3dd2432835dfc598c8b2d1b04c38966f /source4/torture/rpc | |
parent | 7347373e7cb814d683c603ed958583ff70552a2b (diff) | |
download | samba-5f015920a80a22f5486e0679f017db3a5ff9d798.tar.gz samba-5f015920a80a22f5486e0679f017db3a5ff9d798.tar.bz2 samba-5f015920a80a22f5486e0679f017db3a5ff9d798.zip |
s4-smbtorture: add very basic RPC-LSA-LOOKUPNAMES test.
Guenther
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/lsa.c | 66 | ||||
-rw-r--r-- | source4/torture/rpc/rpc.c | 1 |
2 files changed, 67 insertions, 0 deletions
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index 04a8854031..7d03e7ef9e 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -2700,3 +2700,69 @@ bool torture_rpc_lsa_get_user(struct torture_context *tctx) return ret; } + +static bool testcase_LookupNames(struct torture_context *tctx, + struct dcerpc_pipe *p) +{ + bool ret = true; + struct policy_handle *handle; + struct lsa_TransNameArray tnames; + struct lsa_TransNameArray2 tnames2; + + if (!test_OpenPolicy(p, tctx)) { + ret = false; + } + + if (!test_lsa_OpenPolicy2(p, tctx, &handle)) { + ret = false; + } + + if (!handle) { + ret = false; + } + + tnames.count = 1; + tnames.names = talloc_array(tctx, struct lsa_TranslatedName, tnames.count); + ZERO_STRUCT(tnames.names[0]); + tnames.names[0].name.string = "BUILTIN"; + tnames.names[0].sid_type = SID_NAME_DOMAIN; + + if (!test_LookupNames(p, tctx, handle, &tnames)) { + ret = false; + } + + tnames2.count = 1; + tnames2.names = talloc_array(tctx, struct lsa_TranslatedName2, tnames2.count); + ZERO_STRUCT(tnames2.names[0]); + tnames2.names[0].name.string = "BUILTIN"; + tnames2.names[0].sid_type = SID_NAME_DOMAIN; + + if (!test_LookupNames2(p, tctx, handle, &tnames2, true)) { + ret = false; + } + + if (!test_LookupNames3(p, tctx, handle, &tnames2, true)) { + ret = false; + } + + if (!test_lsa_Close(p, tctx, handle)) { + ret = false; + } + + return ret; +} + +struct torture_suite *torture_rpc_lsa_lookup_names(TALLOC_CTX *mem_ctx) +{ + struct torture_suite *suite; + struct torture_rpc_tcase *tcase; + + suite = torture_suite_create(mem_ctx, "LSA-LOOKUPNAMES"); + + tcase = torture_suite_add_rpc_iface_tcase(suite, "lsa", + &ndr_table_lsarpc); + torture_rpc_tcase_add_test(tcase, "LookupNames", + testcase_LookupNames); + + return suite; +} diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c index 5624c32b96..647d51470d 100644 --- a/source4/torture/rpc/rpc.c +++ b/source4/torture/rpc/rpc.c @@ -379,6 +379,7 @@ NTSTATUS torture_rpc_init(void) torture_suite_add_simple_test(suite, "LSALOOKUP", torture_rpc_lsa_lookup); torture_suite_add_simple_test(suite, "LSA-GETUSER", torture_rpc_lsa_get_user); torture_suite_add_suite(suite, torture_rpc_lsa_lookup_sids(suite)); + torture_suite_add_suite(suite, torture_rpc_lsa_lookup_names(suite)); torture_suite_add_suite(suite, torture_rpc_lsa_secrets(suite)); torture_suite_add_suite(suite, torture_rpc_echo(suite)); torture_suite_add_simple_test(suite, "DFS", torture_rpc_dfs); |