summaryrefslogtreecommitdiff
path: root/source4/torture/torture.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/torture.c')
-rw-r--r--source4/torture/torture.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index e3a7d8e5d8..b1e6695e9e 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -136,7 +136,7 @@ BOOL torture_close_connection(struct smbcli_state *c)
}
-/* open a rpc connection to a named pipe */
+/* open a rpc connection to the chosen binding string */
NTSTATUS torture_rpc_connection(struct dcerpc_pipe **p,
const char *pipe_name,
const char *pipe_uuid,
@@ -158,6 +158,39 @@ NTSTATUS torture_rpc_connection(struct dcerpc_pipe **p,
return status;
}
+/* open a rpc connection to a named pipe */
+NTSTATUS torture_rpc_connection_smb(struct dcerpc_pipe **p,
+ const char *pipe_name,
+ const char *pipe_uuid,
+ uint32_t pipe_version)
+{
+ NTSTATUS status;
+ const char *binding = lp_parm_string(-1, "torture", "binding");
+ struct dcerpc_binding b;
+ TALLOC_CTX *mem_ctx = talloc_init("torture_rpc_connection_smb");
+
+ if (!binding) {
+ printf("You must specify a ncacn binding string\n");
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ status = dcerpc_parse_binding(mem_ctx, binding, &b);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("Failed to parse dcerpc binding '%s'\n", binding));
+ talloc_destroy(mem_ctx);
+ return status;
+ }
+
+ b.transport = NCACN_NP;
+
+ status = dcerpc_pipe_connect_b(p, &b, pipe_uuid, pipe_version,
+ lp_parm_string(-1, "torture", "userdomain"),
+ lp_parm_string(-1, "torture", "username"),
+ lp_parm_string(-1, "torture", "password"));
+
+ return status;
+}
+
/* close a rpc connection to a named pipe */
NTSTATUS torture_rpc_close(struct dcerpc_pipe *p)
{