s4:torture/samba3rpc: add pipe_bind_smb2()
authorStefan Metzmacher <metze@samba.org>
Thu, 16 Jan 2014 06:19:26 +0000 (07:19 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 7 Jul 2015 12:05:28 +0000 (14:05 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source4/torture/rpc/samba3rpc.c

index 6832940db4eaabc1c6080219bb489024fb80a4ba..c5cb877b09db6b9f19ebcedcaa858421b6f2c025 100644 (file)
@@ -85,6 +85,39 @@ static NTSTATUS pipe_bind_smb(struct torture_context *tctx,
        return NT_STATUS_OK;
 }
 
+static NTSTATUS pipe_bind_smb2(struct torture_context *tctx,
+                              TALLOC_CTX *mem_ctx,
+                              struct smb2_tree *tree,
+                              const char *pipe_name,
+                              const struct ndr_interface_table *iface,
+                              struct dcerpc_pipe **p)
+{
+       struct dcerpc_pipe *result;
+       NTSTATUS status;
+
+       if (!(result = dcerpc_pipe_init(mem_ctx, tctx->ev))) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       status = dcerpc_pipe_open_smb2(result, tree, pipe_name);
+       if (!NT_STATUS_IS_OK(status)) {
+               torture_comment(tctx, "dcerpc_pipe_open_smb2 failed: %s\n",
+                        nt_errstr(status));
+               talloc_free(result);
+               return status;
+       }
+
+       status = dcerpc_bind_auth_none(result, iface);
+       if (!NT_STATUS_IS_OK(status)) {
+               torture_comment(tctx, "dcerpc_bind_auth_none failed: %s\n", nt_errstr(status));
+               talloc_free(result);
+               return status;
+       }
+
+       *p = result;
+       return NT_STATUS_OK;
+}
+
 /*
  * This tests a RPC call using an invalid vuid
  */