From c2021e4211ee1c4d840995d3adaf3e2494e35719 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Wed, 26 May 2010 04:22:34 +0300 Subject: s4/test: Connect SAMR and LDARPC pipes before calling libnet_ functions In multi-DC environment, NBT name resolution may resolv domain name to any of DCs. This make this test to fail, as we are modifying the user account on one DC and query user info immediately after that on another DC. --- source4/torture/libnet/libnet_user.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index 879b250c07..4bda76378d 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.c @@ -542,10 +542,34 @@ static void set_test_changes(struct torture_context *tctx, } +static bool _libnet_context_init_pipes(struct torture_context *tctx, + struct libnet_context *libnet_ctx) +{ + NTSTATUS status; + + /* connect SAMR pipe */ + status = torture_rpc_connection(tctx, + &libnet_ctx->samr.pipe, + &ndr_table_samr); + torture_assert_ntstatus_ok(tctx, status, "Failed to open SAMR pipe"); + + libnet_ctx->samr.samr_handle = libnet_ctx->samr.pipe->binding_handle; + + + /* connect LSARPC pipe */ + status = torture_rpc_connection(tctx, + &libnet_ctx->lsa.pipe, + &ndr_table_lsarpc); + torture_assert_ntstatus_ok(tctx, status, "Failed to open LSA pipe"); + + libnet_ctx->lsa.lsa_handle = libnet_ctx->lsa.pipe->binding_handle; + + return true; +} + bool torture_modifyuser(struct torture_context *torture) { NTSTATUS status; - struct dcerpc_binding *binding; struct dcerpc_pipe *p; TALLOC_CTX *prep_mem_ctx; struct policy_handle h; @@ -585,14 +609,12 @@ bool torture_modifyuser(struct torture_context *torture) goto done; } - status = torture_rpc_binding(torture, &binding); - if (!NT_STATUS_IS_OK(status)) { - ret = false; - goto done; - } - torture_comment(torture, "Testing change of all fields - each single one in turn\n"); + if (!_libnet_context_init_pipes(torture, ctx)) { + return false; + } + for (fld = USER_FIELD_FIRST; fld <= USER_FIELD_LAST; fld++) { ZERO_STRUCT(req); req.in.domain_name = lp_workgroup(torture->lp_ctx); -- cgit