diff options
author | Günther Deschner <gd@samba.org> | 2007-11-29 21:52:20 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:46:52 +0100 |
commit | 6cb7ea0bc8e13e1eb257a3eb1ff83d08e34f1e45 (patch) | |
tree | eb26c47c874fbed7d841dbf6028366f3559307b2 /source4/torture | |
parent | 4151cf9866640a5eb53730ff069625373b6d8c27 (diff) | |
download | samba-6cb7ea0bc8e13e1eb257a3eb1ff83d08e34f1e45.tar.gz samba-6cb7ea0bc8e13e1eb257a3eb1ff83d08e34f1e45.tar.bz2 samba-6cb7ea0bc8e13e1eb257a3eb1ff83d08e34f1e45.zip |
r26208: Add torture test for (unsupported) wkssvc_NetrJoinDomain() and
wkssvc_NetrUnjoinDomain().
Guenther
(This used to be commit 77c161b776de143aeb23894b3c821fbe4f40ac44)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/rpc/wkssvc.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c index df6544703d..6f43caebf5 100644 --- a/source4/torture/rpc/wkssvc.c +++ b/source4/torture/rpc/wkssvc.c @@ -1055,6 +1055,67 @@ static bool test_NetrGetJoinableOus2(struct torture_context *tctx, return true; } + +static bool test_NetrUnjoinDomain(struct torture_context *tctx, + struct dcerpc_pipe *p) +{ + NTSTATUS status; + struct wkssvc_NetrUnjoinDomain r; + struct cli_credentials *creds = cmdline_credentials; + const char *user = cli_credentials_get_username(creds); + const char *admin_account = NULL; + + admin_account = talloc_asprintf(tctx, "%s\\%s", + lp_workgroup(global_loadparm), + user); + + r.in.server_name = dcerpc_server_name(p); + r.in.Account = admin_account; + r.in.password = NULL; + r.in.unjoin_flags = 0; + + torture_comment(tctx, "testing NetrUnjoinDomain\n"); + + status = dcerpc_wkssvc_NetrUnjoinDomain(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, + "NetrUnjoinDomain failed"); + torture_assert_werr_equal(tctx, r.out.result, WERR_NOT_SUPPORTED, + "NetrUnjoinDomain failed"); + return true; +} + + +static bool test_NetrJoinDomain(struct torture_context *tctx, + struct dcerpc_pipe *p) +{ + NTSTATUS status; + struct wkssvc_NetrJoinDomain r; + struct cli_credentials *creds = cmdline_credentials; + const char *user = cli_credentials_get_username(creds); + const char *admin_account = NULL; + + admin_account = talloc_asprintf(tctx, "%s\\%s", + lp_workgroup(global_loadparm), + user); + + r.in.server_name = dcerpc_server_name(p); + r.in.domain_name = lp_realm(global_loadparm); + r.in.account_ou = NULL; + r.in.Account = admin_account; + r.in.password = NULL; + r.in.join_flags = 0; + + torture_comment(tctx, "testing NetrJoinDomain\n"); + + status = dcerpc_wkssvc_NetrJoinDomain(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, + "NetrJoinDomain failed"); + torture_assert_werr_equal(tctx, r.out.result, WERR_NOT_SUPPORTED, + "NetrJoinDomain failed"); + return true; +} + + struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx) { struct torture_suite *suite; @@ -1113,6 +1174,12 @@ struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx) torture_rpc_tcase_add_test(tcase, "NetrEnumerateComputerNames", test_NetrEnumerateComputerNames); + torture_rpc_tcase_add_test(tcase, "NetrJoinDomain", + test_NetrJoinDomain); + test->dangerous = true; + torture_rpc_tcase_add_test(tcase, "NetrUnjoinDomain", + test_NetrUnjoinDomain); + test->dangerous = true; torture_rpc_tcase_add_test(tcase, "NetrGetJoinInformation", test_NetrGetJoinInformation); torture_rpc_tcase_add_test(tcase, "NetrGetJoinableOus", |