s4-torture: add torture_rpc_connection_with_binding()
authorGünther Deschner <gd@samba.org>
Thu, 27 Oct 2016 12:12:35 +0000 (14:12 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 15 Nov 2016 00:14:21 +0000 (01:14 +0100)
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/torture/rpc/rpc.c
source4/torture/rpc/torture_rpc.h

index e0ed70ccbc95518570023e3d2d42b82438aabe55..3fc20c0190c2928c55ad42107ccf8e6ff96ab23f 100644 (file)
@@ -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));
index 2f65baa64f798eb1ac7fecf1188ceee94fe011a0..77df5de341d80c289ac0ee506131f3aeb9f23a2e 100644 (file)
@@ -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,