From 46046aa69be01d4868395b9b52b8bcd22c3859e5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 4 Nov 2003 09:10:31 +0000 Subject: yipee! we can now do lsaOpenPolicy() via the new interfaces, without using any of the old lsa code (This used to be commit f5bd301ff7befa223a1d761a37ae8f7ce7f1fcd1) --- source4/torture/torture.c | 52 +++++------------------------------------------ 1 file changed, 5 insertions(+), 47 deletions(-) (limited to 'source4/torture/torture.c') diff --git a/source4/torture/torture.c b/source4/torture/torture.c index bb5741c54f..d88a58032f 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -135,65 +135,23 @@ BOOL torture_close_connection(struct cli_state *c) NTSTATUS torture_rpc_connection(struct dcerpc_pipe **p, const char *pipe_name) { struct cli_state *cli; - int fnum; NTSTATUS status; - char *name = NULL; - union smb_open open_parms; - TALLOC_CTX *mem_ctx; if (!torture_open_connection(&cli)) { return NT_STATUS_UNSUCCESSFUL; } - asprintf(&name, "\\%s", pipe_name); - if (!name) { - return NT_STATUS_NO_MEMORY; - } - - open_parms.ntcreatex.level = RAW_OPEN_NTCREATEX; - open_parms.ntcreatex.in.flags = 0; - open_parms.ntcreatex.in.root_fid = 0; - open_parms.ntcreatex.in.access_mask = - STD_RIGHT_READ_CONTROL_ACCESS | - SA_RIGHT_FILE_WRITE_ATTRIBUTES | - SA_RIGHT_FILE_WRITE_EA | - GENERIC_RIGHTS_FILE_READ | - GENERIC_RIGHTS_FILE_WRITE; - open_parms.ntcreatex.in.file_attr = 0; - open_parms.ntcreatex.in.alloc_size = 0; - open_parms.ntcreatex.in.share_access = - NTCREATEX_SHARE_ACCESS_READ | - NTCREATEX_SHARE_ACCESS_WRITE; - open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; - open_parms.ntcreatex.in.create_options = 0; - open_parms.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_IMPERSONATION; - open_parms.ntcreatex.in.security_flags = 0; - open_parms.ntcreatex.in.fname = name; - - mem_ctx = talloc_init("torture_rpc_connection"); - status = smb_raw_open(cli->tree, mem_ctx, &open_parms); - free(name); - talloc_destroy(mem_ctx); - + if (!(*p = dcerpc_pipe_init(cli->tree))) { + return NT_STATUS_NO_MEMORY; + } + + status = dcerpc_pipe_open_smb(*p, pipe_name); if (!NT_STATUS_IS_OK(status)) { printf("Open of pipe %s failed with error (%s)\n", pipe_name, nt_errstr(status)); return status; } - if (!(*p = dcerpc_pipe_init(cli->tree))) { - return NT_STATUS_NO_MEMORY; - } - - (*p)->fnum = open_parms.ntcreatex.out.fnum; - - status = cli_dcerpc_bind_byname(*p, pipe_name); - - if (!NT_STATUS_IS_OK(status)) { - cli_close(cli, fnum); - dcerpc_pipe_close(*p); - } - return status; } -- cgit