diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-05-26 04:22:34 +0300 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-05-26 14:36:15 +0300 |
commit | c2021e4211ee1c4d840995d3adaf3e2494e35719 (patch) | |
tree | 8b88dfcb25e3070debd974bf783599818304b3ce /source4 | |
parent | de60cbb6e75fb1f6fe42fd0e86204d304911d30c (diff) | |
download | samba-c2021e4211ee1c4d840995d3adaf3e2494e35719.tar.gz samba-c2021e4211ee1c4d840995d3adaf3e2494e35719.tar.bz2 samba-c2021e4211ee1c4d840995d3adaf3e2494e35719.zip |
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.
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/libnet/libnet_user.c | 36 |
1 files 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); |