From b53b3b8e327c5f7983be8f2e403aa252145487a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Thu, 27 Oct 2016 14:12:35 +0200 Subject: [PATCH] s4-torture: add torture_rpc_connection_with_binding() Guenther Signed-off-by: Guenther Deschner Reviewed-by: Jeremy Allison --- source4/torture/rpc/rpc.c | 21 +++++++++++++++++---- source4/torture/rpc/torture_rpc.h | 4 ++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c index e0ed70ccbc9..3fc20c0190c 100644 --- a/source4/torture/rpc/rpc.c +++ b/source4/torture/rpc/rpc.c @@ -75,16 +75,29 @@ _PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx, NTSTATUS status; struct dcerpc_binding *binding; - dcerpc_init(); - status = torture_rpc_binding(tctx, &binding); if (NT_STATUS_IS_ERR(status)) return status; - status = dcerpc_pipe_connect_b(tctx, + return torture_rpc_connection_with_binding(tctx, binding, p, table); +} + +/** + * open a rpc connection to the chosen binding string + */ +_PUBLIC_ NTSTATUS torture_rpc_connection_with_binding(struct torture_context *tctx, + struct dcerpc_binding *binding, + struct dcerpc_pipe **p, + const struct ndr_interface_table *table) +{ + NTSTATUS status; + + dcerpc_init(); + + status = dcerpc_pipe_connect_b(tctx, p, binding, table, cmdline_credentials, tctx->ev, tctx->lp_ctx); - + if (NT_STATUS_IS_ERR(status)) { torture_warning(tctx, "Failed to connect to remote server: %s %s\n", dcerpc_binding_string(tctx, binding), nt_errstr(status)); diff --git a/source4/torture/rpc/torture_rpc.h b/source4/torture/rpc/torture_rpc.h index 2f65baa64f7..77df5de341d 100644 --- a/source4/torture/rpc/torture_rpc.h +++ b/source4/torture/rpc/torture_rpc.h @@ -45,6 +45,10 @@ struct torture_rpc_tcase_data { NTSTATUS torture_rpc_connection(struct torture_context *tctx, struct dcerpc_pipe **p, const struct ndr_interface_table *table); +NTSTATUS torture_rpc_connection_with_binding(struct torture_context *tctx, + struct dcerpc_binding *binding, + struct dcerpc_pipe **p, + const struct ndr_interface_table *table); struct test_join *torture_join_domain(struct torture_context *tctx, const char *machine_name,