From 3b53566ebb2be28dae82198e35bc27003eaf7b21 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 17 Sep 2013 07:01:57 +0200 Subject: s4:tortore:raw/qfileinfo: don't use dcerpc_pipe_open_smb() to open a named pipe We can directly use smb_raw_open() to open a handle to a named pipe. This avoids the need for the layer violation functions dcerpc_smb_tree() and dcerpc_smb_fnum(). Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam Reviewed-by: Andrew Bartlett --- source4/torture/raw/qfileinfo.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c index 4f6d8d56b9..1e7d9024e1 100644 --- a/source4/torture/raw/qfileinfo.c +++ b/source4/torture/raw/qfileinfo.c @@ -885,22 +885,39 @@ bool torture_raw_qfileinfo_pipe(struct torture_context *torture, bool ret = true; int fnum; const char *fname = "\\lsass"; - struct dcerpc_pipe *p; - struct smbcli_tree *ipc_tree; + union smb_open op; NTSTATUS status; - if (!(p = dcerpc_pipe_init(torture, torture->ev))) { - return false; - } - - status = dcerpc_pipe_open_smb(p, cli->tree, fname); + op.ntcreatex.level = RAW_OPEN_NTCREATEX; + op.ntcreatex.in.flags = 0; + op.ntcreatex.in.root_fid.fnum = 0; + op.ntcreatex.in.access_mask = + SEC_STD_READ_CONTROL | + SEC_FILE_WRITE_ATTRIBUTE | + SEC_FILE_WRITE_EA | + SEC_FILE_READ_DATA | + SEC_FILE_WRITE_DATA; + op.ntcreatex.in.file_attr = 0; + op.ntcreatex.in.alloc_size = 0; + op.ntcreatex.in.share_access = + NTCREATEX_SHARE_ACCESS_READ | + NTCREATEX_SHARE_ACCESS_WRITE; + op.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; + op.ntcreatex.in.create_options = 0; + op.ntcreatex.in.impersonation = + NTCREATEX_IMPERSONATION_IMPERSONATION; + op.ntcreatex.in.security_flags = 0; + op.ntcreatex.in.fname = fname; + + status = smb_raw_open(cli->tree, torture, &op); torture_assert_ntstatus_ok(torture, status, "dcerpc_pipe_open_smb failed"); - ipc_tree = dcerpc_smb_tree(p->conn); - fnum = dcerpc_smb_fnum(p->conn); + fnum = op.ntcreatex.out.file.fnum; - ret = torture_raw_qfileinfo_internals(torture, torture, ipc_tree, fnum, fname, true /* is_ipc */); - - talloc_free(p); + ret = torture_raw_qfileinfo_internals(torture, torture, cli->tree, + fnum, fname, + true /* is_ipc */); + + smbcli_close(cli->tree, fnum); return ret; } -- cgit