[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Mon May 28 13:49:02 MDT 2012


The branch, master has been updated
       via  e4c59a6 s4:ntvfs/ipc: fix protocol specific processing of pipe names
       via  ac4d23e s3:selftest: run rpc.samba3.smb[1|2]-pipe-name
       via  69fd1bb s3:rpc_server: don't do any magic in is_known_pipename() anymore
       via  abf566c s3:smbd: fix reply_open_pipe_and_X() to behave like windows (2008 R2)
       via  e262db6 s3:smbd: only strip \ off the name if present (for ntcreatex)
       via  6777e34 s3:rpc_server: return OBJECT_NAME_NOT_FOUND instead of PIPE_NOT_AVAILABLE
       via  98c14ca s3:smb2_create: do not remove leading backslash from pipe names
       via  081b484 s4:torture/samba3rpc: add smb1-pipe-name
       via  c211216 s4:torture/samba3rpc: add smb2-pipe-name
       via  697c88d s3:cli_np_tstream: pass a leading backslash for the pipe name for SMB1
       via  1e5010f s3:rpc_client: tstream_cli_np_open_send() doesn't expect a leading backslash
      from  4688107 s3:libsmb: get rid of cli_ucs2

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e4c59a66aa8ea113c38cc9c2f04a825983ee4fdc
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 28 19:44:04 2012 +0200

    s4:ntvfs/ipc: fix protocol specific processing of pipe names
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Mon May 28 21:48:47 CEST 2012 on sn-devel-104

commit ac4d23ebeb21c5f00c13b79c17c666ac54b6f08d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 28 15:56:14 2012 +0200

    s3:selftest: run rpc.samba3.smb[1|2]-pipe-name
    
    metze

commit 69fd1bb66e757212f8866db23f95626fb9d1c573
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 28 16:49:23 2012 +0200

    s3:rpc_server: don't do any magic in is_known_pipename() anymore
    
    The callers have to check if they allow something else than
    the raw pipe file name.
    
    If we allow more than windows allows, we risks Samba specific
    client behavior. E.g. winbindd only works against Samba servers.
    
    metze

commit abf566ca994b8e2b47ab3da69cde67568bca8d71
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 28 18:23:50 2012 +0200

    s3:smbd: fix reply_open_pipe_and_X() to behave like windows (2008 R2)
    
    See rpc.samba3.smb1-pipe-name.
    
    metze

commit e262db6c3173e977b08f1db37ae11e391246cc30
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 28 16:40:36 2012 +0200

    s3:smbd: only strip \\ off the name if present (for ntcreatex)
    
    metze

commit 6777e345b1512345e8b74dfe0956982afc59895e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 28 16:27:29 2012 +0200

    s3:rpc_server: return OBJECT_NAME_NOT_FOUND instead of PIPE_NOT_AVAILABLE
    
    metze

commit 98c14ca61cb372795cb0ccb63430290b57ede086
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 28 15:25:53 2012 +0200

    s3:smb2_create: do not remove leading backslash from pipe names
    
    metze

commit 081b484181525878108cf4e430a1bf9d285f351c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 28 16:23:22 2012 +0200

    s4:torture/samba3rpc: add smb1-pipe-name
    
    metze

commit c211216e43bb86c981f3badb1b38e0bda389df10
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 28 15:38:00 2012 +0200

    s4:torture/samba3rpc: add smb2-pipe-name
    
    metze

commit 697c88d6b194259260c802a2a66215d5aa89726d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 28 15:29:17 2012 +0200

    s3:cli_np_tstream: pass a leading backslash for the pipe name for SMB1
    
    metze

commit 1e5010fd9978e0d65c25a7f2cbea399813e21d26
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 28 18:43:29 2012 +0200

    s3:rpc_client: tstream_cli_np_open_send() doesn't expect a leading backslash
    
    This fixes winbindd against a windows server using SMB2.
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source3/libsmb/cli_np_tstream.c       |   14 ++-
 source3/rpc_client/rpc_transport_np.c |    4 +
 source3/rpc_server/srv_pipe.c         |   15 +--
 source3/rpc_server/srv_pipe_hnd.c     |    2 +-
 source3/selftest/tests.py             |    1 +
 source3/smbd/nttrans.c                |    6 +-
 source3/smbd/pipes.c                  |   26 ++-
 source3/smbd/smb2_create.c            |    5 -
 source4/ntvfs/ipc/vfs_ipc.c           |    8 +-
 source4/torture/rpc/samba3rpc.c       |  336 +++++++++++++++++++++++++++++++++
 10 files changed, 383 insertions(+), 34 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/cli_np_tstream.c b/source3/libsmb/cli_np_tstream.c
index f7e609d..9d5d013 100644
--- a/source3/libsmb/cli_np_tstream.c
+++ b/source3/libsmb/cli_np_tstream.c
@@ -151,8 +151,20 @@ struct tevent_req *tstream_cli_np_open_send(TALLOC_CTX *mem_ctx,
 	}
 
 	if (state->is_smb1) {
+		const char *smb1_npipe;
+
+		/*
+		 * Windows and newer Samba versions allow
+		 * the pipe name without leading backslash,
+		 * but we should better behave like windows clients
+		 */
+		smb1_npipe = talloc_asprintf(state, "\\%s", state->npipe);
+		if (tevent_req_nomem(smb1_npipe, req)) {
+			return tevent_req_post(req, ev);
+		}
+
 		subreq = cli_ntcreate_send(state, ev, cli,
-					   npipe,
+					   smb1_npipe,
 					   0,
 					   DESIRED_ACCESS_PIPE,
 					   0,
diff --git a/source3/rpc_client/rpc_transport_np.c b/source3/rpc_client/rpc_transport_np.c
index c66d4b8..0be07eb 100644
--- a/source3/rpc_client/rpc_transport_np.c
+++ b/source3/rpc_client/rpc_transport_np.c
@@ -52,6 +52,10 @@ struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
 		return tevent_req_post(req, ev);
 	}
 
+	while (pipe_name[0] == '\\') {
+		pipe_name++;
+	}
+
 	subreq = tstream_cli_np_open_send(state, ev, cli, pipe_name);
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index 0bc48b1..a870ec1 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -376,22 +376,13 @@ static bool check_bind_req(struct pipes_struct *p,
 
 /**
  * Is a named pipe known?
- * @param[in] cli_filename	The pipe name requested by the client
+ * @param[in] pipename		Just the filename
  * @result			Do we want to serve this?
  */
-bool is_known_pipename(const char *cli_filename, struct ndr_syntax_id *syntax)
+bool is_known_pipename(const char *pipename, struct ndr_syntax_id *syntax)
 {
-	const char *pipename = cli_filename;
 	NTSTATUS status;
 
-	if (strnequal(pipename, "\\PIPE\\", 6)) {
-		pipename += 5;
-	}
-
-	if (*pipename == '\\') {
-		pipename += 1;
-	}
-
 	if (lp_disable_spoolss() && strequal(pipename, "spoolss")) {
 		DEBUG(10, ("refusing spoolss access\n"));
 		return false;
@@ -403,7 +394,7 @@ bool is_known_pipename(const char *cli_filename, struct ndr_syntax_id *syntax)
 
 	status = smb_probe_module("rpc", pipename);
 	if (!NT_STATUS_IS_OK(status)) {
-		DEBUG(10, ("is_known_pipename: %s unknown\n", cli_filename));
+		DEBUG(10, ("is_known_pipename: %s unknown\n", pipename));
 		return false;
 	}
 	DEBUG(10, ("is_known_pipename: %s loaded dynamically\n", pipename));
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index e4172e7..0c615bd 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -470,7 +470,7 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
 
 	if (handle->private_data == NULL) {
 		TALLOC_FREE(handle);
-		return NT_STATUS_PIPE_NOT_AVAILABLE;
+		return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 	}
 
 	*phandle = handle;
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index ce80274..d876ef5 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -247,6 +247,7 @@ rpc = ["rpc.authcontext", "rpc.samba3.bind", "rpc.samba3.srvsvc", "rpc.samba3.sh
        "rpc.samba3.spoolss", "rpc.samba3.wkssvc", "rpc.samba3.winreg",
        "rpc.samba3.getaliasmembership-0",
        "rpc.samba3.netlogon", "rpc.samba3.sessionkey", "rpc.samba3.getusername",
+       "rpc.samba3.smb1-pipe-name", "rpc.samba3.smb2-pipe-name",
        "rpc.svcctl", "rpc.ntsvcs", "rpc.winreg", "rpc.eventlog",
        "rpc.spoolss.printserver", "rpc.spoolss.win", "rpc.spoolss.notify", "rpc.spoolss.printer",
        "rpc.spoolss.driver",
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 168ef56..53e1713 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -291,8 +291,10 @@ static void nt_open_pipe(char *fname, connection_struct *conn,
 
 	DEBUG(4,("nt_open_pipe: Opening pipe %s.\n", fname));
 
-	/* Strip \\ off the name. */
-	fname++;
+	/* Strip \\ off the name if present. */
+	while (fname[0] == '\\') {
+		fname++;
+	}
 
 	status = open_np_file(req, fname, &fsp);
 	if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index f9e3618..bb62739 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -31,11 +31,6 @@
 #include "libcli/security/security.h"
 #include "rpc_server/srv_pipe_hnd.h"
 
-#define	PIPE		"\\PIPE\\"
-#define	PIPELEN		strlen(PIPE)
-
-#define MAX_PIPE_NAME_LEN	24
-
 NTSTATUS open_np_file(struct smb_request *smb_req, const char *name,
 		      struct files_struct **pfsp)
 {
@@ -112,15 +107,24 @@ void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req)
 	/* If the name doesn't start \PIPE\ then this is directed */
 	/* at a mailslot or something we really, really don't understand, */
 	/* not just something we really don't understand. */
-	if ( strncmp(pipe_name,PIPE,PIPELEN) != 0 ) {
-		reply_nterror(req, NT_STATUS_ACCESS_DENIED);
+
+#define	PIPE		"PIPE\\"
+#define	PIPELEN		strlen(PIPE)
+
+	fname = pipe_name;
+	while (fname[0] == '\\') {
+		fname++;
+	}
+	if (!strnequal(fname, PIPE, PIPELEN)) {
+		reply_nterror(req, NT_STATUS_OBJECT_PATH_SYNTAX_BAD);
 		return;
 	}
+	fname += PIPELEN;
+	while (fname[0] == '\\') {
+		fname++;
+	}
 
-	DEBUG(4,("Opening pipe %s.\n", pipe_name));
-
-	/* Strip \PIPE\ off the name. */
-	fname = pipe_name + PIPELEN;
+	DEBUG(4,("Opening pipe %s => %s.\n", pipe_name, fname));
 
 #if 0
 	/*
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 35be328..b8ad388 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -477,11 +477,6 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 			return tevent_req_post(req, ev);
 		}
 
-		/* Strip \\ off the name. */
-		if (pipe_name[0] == '\\') {
-			pipe_name++;
-		}
-
 		status = open_np_file(smb1req, pipe_name, &result);
 		if (!NT_STATUS_IS_OK(status)) {
 			tevent_req_nterror(req, status);
diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c
index 5905e0c..7fc3b14 100644
--- a/source4/ntvfs/ipc/vfs_ipc.c
+++ b/source4/ntvfs/ipc/vfs_ipc.c
@@ -260,9 +260,15 @@ static NTSTATUS ipc_open(struct ntvfs_module_context *ntvfs,
 	case RAW_OPEN_NTCREATEX:
 	case RAW_OPEN_NTTRANS_CREATE:
 		fname = oi->ntcreatex.in.fname;
+		while (fname[0] == '\\') fname++;
 		break;
 	case RAW_OPEN_OPENX:
 		fname = oi->openx.in.fname;
+		while (fname[0] == '\\') fname++;
+		if (strncasecmp(fname, "PIPE\\", 5) != 0) {
+			return NT_STATUS_OBJECT_PATH_SYNTAX_BAD;
+		}
+		while (fname[0] == '\\') fname++;
 		break;
 	case RAW_OPEN_SMB2:
 		fname = oi->smb2.in.fname;
@@ -284,8 +290,6 @@ static NTSTATUS ipc_open(struct ntvfs_module_context *ntvfs,
 	p = talloc(h, struct pipe_state);
 	NT_STATUS_HAVE_NO_MEMORY(p);
 
-	while (fname[0] == '\\') fname++;
-
 	/* check for valid characters in name */
 	fname = strlower_talloc(p, fname);
 
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 30a3b85..2a905ea 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -3876,6 +3876,340 @@ done:
 	return ret;
 }
 
+static bool torture_rpc_smb1_pipe_name(struct torture_context *torture)
+{
+	TALLOC_CTX *mem_ctx;
+	NTSTATUS status;
+	bool ret = false;
+	struct smbcli_state *cli;
+	struct smbcli_options options;
+	struct smbcli_session_options session_options;
+	union smb_open io;
+	union smb_close cl;
+	uint16_t fnum;
+
+	mem_ctx = talloc_init("torture_samba3_smb1_pipe_name");
+	torture_assert(torture, (mem_ctx != NULL), "talloc_init failed");
+
+	lpcfg_smbcli_options(torture->lp_ctx, &options);
+	lpcfg_smbcli_session_options(torture->lp_ctx, &session_options);
+
+	status = smbcli_full_connection(mem_ctx, &cli,
+					torture_setting_string(torture, "host", NULL),
+					lpcfg_smb_ports(torture->lp_ctx),
+					"IPC$", NULL,
+					lpcfg_socket_options(torture->lp_ctx),
+					cmdline_credentials,
+					lpcfg_resolve_context(torture->lp_ctx),
+					torture->ev, &options, &session_options,
+					lpcfg_gensec_settings(torture, torture->lp_ctx));
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smbcli_full_connection failed");
+
+	ZERO_STRUCT(io);
+	io.generic.level = RAW_OPEN_NTCREATEX;
+	io.ntcreatex.in.access_mask = DESIRED_ACCESS_PIPE;
+	io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ|
+				       NTCREATEX_SHARE_ACCESS_WRITE;
+	io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
+	io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_IMPERSONATION;
+	io.ntcreatex.in.security_flags = 0;
+
+	io.ntcreatex.in.fname = "__none__";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
+					   ret, done,
+					   "smb_raw_open for '__none__'");
+
+	io.ntcreatex.in.fname = "pipe\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
+					   ret, done,
+					   "smb_raw_open for 'pipe\\srvsvc'");
+
+	io.ntcreatex.in.fname = "\\pipe\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
+					   ret, done,
+					   "smb_raw_open for '\\pipe\\srvsvc'");
+
+	io.ntcreatex.in.fname = "srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb2_create failed for 'srvsvc'");
+	fnum = io.ntcreatex.out.file.fnum;
+	ZERO_STRUCT(cl);
+	cl.generic.level = RAW_CLOSE_CLOSE;
+	cl.close.in.file.fnum = fnum;
+	status = smb_raw_close(cli->tree, &cl);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb_raw_close failed");
+
+	io.ntcreatex.in.fname = "\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb2_create failed for '\\srvsvc'");
+	fnum = io.ntcreatex.out.file.fnum;
+	ZERO_STRUCT(cl);
+	cl.generic.level = RAW_CLOSE_CLOSE;
+	cl.close.in.file.fnum = fnum;
+	status = smb_raw_close(cli->tree, &cl);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb_raw_close failed");
+
+	io.ntcreatex.in.fname = "\\\\\\\\\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb2_create failed for '\\\\\\\\\\srvsvc'");
+	fnum = io.ntcreatex.out.file.fnum;
+	ZERO_STRUCT(cl);
+	cl.generic.level = RAW_CLOSE_CLOSE;
+	cl.close.in.file.fnum = fnum;
+	status = smb_raw_close(cli->tree, &cl);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb_raw_close failed");
+
+	ZERO_STRUCT(io);
+	io.generic.level = RAW_OPEN_NTTRANS_CREATE;
+	io.nttrans.in.access_mask = DESIRED_ACCESS_PIPE;
+	io.nttrans.in.share_access = NTCREATEX_SHARE_ACCESS_READ|
+				       NTCREATEX_SHARE_ACCESS_WRITE;
+	io.nttrans.in.open_disposition = NTCREATEX_DISP_OPEN;
+	io.nttrans.in.impersonation = NTCREATEX_IMPERSONATION_IMPERSONATION;
+	io.nttrans.in.security_flags = 0;
+
+	io.nttrans.in.fname = "__none__";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
+					   ret, done,
+					   "smb_raw_open for '__none__'");
+
+	io.nttrans.in.fname = "pipe\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
+					   ret, done,
+					   "smb_raw_open for 'pipe\\srvsvc'");
+
+	io.nttrans.in.fname = "\\pipe\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
+					   ret, done,
+					   "smb_raw_open for '\\pipe\\srvsvc'");
+
+	io.nttrans.in.fname = "srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb2_create failed for 'srvsvc'");
+	fnum = io.nttrans.out.file.fnum;
+	ZERO_STRUCT(cl);
+	cl.generic.level = RAW_CLOSE_CLOSE;
+	cl.close.in.file.fnum = fnum;
+	status = smb_raw_close(cli->tree, &cl);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb_raw_close failed");
+
+	io.nttrans.in.fname = "\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb2_create failed for '\\srvsvc'");
+	fnum = io.nttrans.out.file.fnum;
+	ZERO_STRUCT(cl);
+	cl.generic.level = RAW_CLOSE_CLOSE;
+	cl.close.in.file.fnum = fnum;
+	status = smb_raw_close(cli->tree, &cl);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb_raw_close failed");
+
+	io.nttrans.in.fname = "\\\\\\\\\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb2_create failed for '\\\\\\\\\\srvsvc'");
+	fnum = io.nttrans.out.file.fnum;
+	ZERO_STRUCT(cl);
+	cl.generic.level = RAW_CLOSE_CLOSE;
+	cl.close.in.file.fnum = fnum;
+	status = smb_raw_close(cli->tree, &cl);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb_raw_close failed");
+
+	ZERO_STRUCT(io);
+	io.generic.level = RAW_OPEN_OPENX;
+	io.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR;
+	io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN;
+
+	io.openx.in.fname = "__none__";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD,
+					   ret, done,
+					   "smb_raw_open for '__none__'");
+
+	io.openx.in.fname = "srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD,
+					   ret, done,
+					   "smb_raw_open for 'srvsvc'");
+
+	io.openx.in.fname = "\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD,
+					   ret, done,
+					   "smb_raw_open for '\\srvsvc'");
+
+	io.openx.in.fname = "\\pipesrvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD,
+					   ret, done,
+					   "smb_raw_open for '\\pipesrvsvc'");
+
+	io.openx.in.fname = "pipe\\__none__";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
+					   ret, done,
+					   "smb_raw_open for 'pipe\\__none__'");
+
+	io.openx.in.fname = "\\pipe\\__none__";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
+					   ret, done,
+					   "smb_raw_open for '\\pipe\\__none__'");
+
+	io.openx.in.fname = "pipe\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb2_create failed for 'pipe\\srvsvc'");
+	fnum = io.openx.out.file.fnum;
+	ZERO_STRUCT(cl);
+	cl.generic.level = RAW_CLOSE_CLOSE;
+	cl.close.in.file.fnum = fnum;
+	status = smb_raw_close(cli->tree, &cl);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb_raw_close failed");
+
+	io.openx.in.fname = "\\pipe\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb2_create failed for '\\pipe\\srvsvc'");
+	fnum = io.openx.out.file.fnum;
+	ZERO_STRUCT(cl);
+	cl.generic.level = RAW_CLOSE_CLOSE;
+	cl.close.in.file.fnum = fnum;
+	status = smb_raw_close(cli->tree, &cl);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb_raw_close failed");
+
+	io.openx.in.fname = "\\\\\\\\\\pipe\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb2_create failed for '\\\\\\\\\\pipe\\srvsvc'");
+	fnum = io.openx.out.file.fnum;
+	ZERO_STRUCT(cl);
+	cl.generic.level = RAW_CLOSE_CLOSE;
+	cl.close.in.file.fnum = fnum;
+	status = smb_raw_close(cli->tree, &cl);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb_raw_close failed");
+
+	io.openx.in.fname = "\\\\\\\\\\pipe\\\\\\\\\\srvsvc";
+	status = smb_raw_open(cli->tree, torture, &io);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb2_create failed for '\\\\\\\\\\pipe\\\\\\\\\\srvsvc'");
+	fnum = io.openx.out.file.fnum;
+	ZERO_STRUCT(cl);
+	cl.generic.level = RAW_CLOSE_CLOSE;
+	cl.close.in.file.fnum = fnum;
+	status = smb_raw_close(cli->tree, &cl);
+	torture_assert_ntstatus_ok_goto(torture, status, ret, done,
+					"smb_raw_close failed");
+	ret = true;
+
+done:
+	talloc_free(mem_ctx);
+	return ret;
+}
+
+static bool torture_rpc_smb2_pipe_name(struct torture_context *torture)
+{
+	TALLOC_CTX *mem_ctx;
+	NTSTATUS status;
+	bool ret = false;
+	struct smbcli_options options;
+	const char *host = torture_setting_string(torture, "host", NULL);
+	struct smb2_tree *tree;
+	struct smb2_handle h;
+	struct smb2_create io;
+
+	mem_ctx = talloc_init("torture_samba3_smb2_pipe_name");
+	torture_assert(torture, (mem_ctx != NULL), "talloc_init failed");
+
+	lpcfg_smbcli_options(torture->lp_ctx, &options);
+
+	status = smb2_connect(mem_ctx,
+			      host,
+			      lpcfg_smb_ports(torture->lp_ctx),
+			      "IPC$",
+			      lpcfg_resolve_context(torture->lp_ctx),
+			      cmdline_credentials,
+			      &tree,
+			      torture->ev,
+			      &options,
+			      lpcfg_socket_options(torture->lp_ctx),
+			      lpcfg_gensec_settings(torture, torture->lp_ctx)
+			      );


-- 
Samba Shared Repository


More information about the samba-cvs mailing list