[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Mon Feb 27 19:20:03 MST 2012


The branch, master has been updated
       via  62d8d03 s4:selftest: skip smb2.session testsuite
       via  a87e3ec s4:selftest: remove old "samba4.smb2.persistent.handle1" from knownfail - test does not exist
       via  60a4095 s4:torture:smb2: add new "session" testsuite starting with a session.reconnect test
       via  ba4acf0 s4:torture:smb2: add durable_open.reopen2a - variant of reopen2 with session reconnect
       via  1d9df36 s4:torture:smb2: add torture_smb2_connection_ext() that takes previous_session
       via  28b7760 s4:libcli:smb2: add a smb2_connect_ext variant of smb2_connect that takes a previous_session argument
       via  e921098 s4:libcli:smb2: add a previous session argument to smb2_connect_send()
       via  681bca6 s4:torture:smb2: add previous_session argument to torture_smb2_session_setup()
       via  69a64e6 s4:libcli:smb2: add a previous session argument to smb2_session_setup_spnego()
       via  727f3ee s3:libsmb:smb2: pass previous session ID to session setup, not previous session
      from  5ebbd46 s3-winbindd: Close netlogon connection if the status returned by the NetrSamLogonEx call is timeout in the pam_auth_crap path

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


- Log -----------------------------------------------------------------
commit 62d8d03c8c6fcd006810613aaff6cd73d63a2774
Author: Michael Adam <obnox at samba.org>
Date:   Tue Feb 28 01:44:10 2012 +0100

    s4:selftest: skip smb2.session testsuite
    
    Autobuild-User: Michael Adam <obnox at samba.org>
    Autobuild-Date: Tue Feb 28 03:19:52 CET 2012 on sn-devel-104

commit a87e3ec1075dbbd8378d60ad7495ddbde2963d82
Author: Michael Adam <obnox at samba.org>
Date:   Tue Feb 28 01:27:59 2012 +0100

    s4:selftest: remove old "samba4.smb2.persistent.handle1" from knownfail - test does not exist

commit 60a4095936325dfb9fe7013235e51b93fb7de1f3
Author: Michael Adam <obnox at samba.org>
Date:   Sun Feb 26 17:53:13 2012 +0100

    s4:torture:smb2: add new "session" testsuite starting with a session.reconnect test

commit ba4acf05b24527e6de117c7f82324b6eab237717
Author: Michael Adam <obnox at samba.org>
Date:   Sun Feb 26 02:36:13 2012 +0100

    s4:torture:smb2: add durable_open.reopen2a - variant of reopen2 with session reconnect

commit 1d9df362b249bcd4636a414c7fa61ab3adfdc832
Author: Michael Adam <obnox at samba.org>
Date:   Sun Feb 26 01:45:53 2012 +0100

    s4:torture:smb2: add torture_smb2_connection_ext() that takes previous_session

commit 28b77605c48494b27e50d18c488c7a65be74fce3
Author: Michael Adam <obnox at samba.org>
Date:   Sun Feb 26 01:45:00 2012 +0100

    s4:libcli:smb2: add a smb2_connect_ext variant of smb2_connect that takes a previous_session argument

commit e9210987c6961a9fd81602d155604eb4dbe388fa
Author: Michael Adam <obnox at samba.org>
Date:   Sun Feb 26 01:43:50 2012 +0100

    s4:libcli:smb2: add a previous session argument to smb2_connect_send()

commit 681bca6768b8a054ac1178d1ff344c302dcd6846
Author: Michael Adam <obnox at samba.org>
Date:   Sun Feb 26 01:36:51 2012 +0100

    s4:torture:smb2: add previous_session argument to torture_smb2_session_setup()
    
    To allow for doing a session reconnect

commit 69a64e6695779437b13b621ea6fb778bf1501cc8
Author: Michael Adam <obnox at samba.org>
Date:   Sat Feb 25 22:32:03 2012 +0100

    s4:libcli:smb2: add a previous session argument to smb2_session_setup_spnego()
    
    So that we can do a session reconnect.

commit 727f3ee6acf8c7d8a4fd2c8a02eadf496e3687af
Author: Michael Adam <obnox at samba.org>
Date:   Sun Feb 26 17:35:28 2012 +0100

    s3:libsmb:smb2: pass previous session ID to session setup, not previous session
    
    We only need the session, and under some circumstances, it might complicate
    things for the caller to have to cope with the whole structure (talloc...).

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

Summary of changes:
 selftest/knownfail                  |    1 -
 selftest/skip                       |    1 +
 source3/libsmb/cliconnect.c         |    2 +-
 source3/libsmb/smb2cli.h            |    2 +-
 source3/libsmb/smb2cli_session.c    |   10 +--
 source3/torture/test_smb2.c         |   14 ++--
 source4/libcli/smb2/connect.c       |   53 ++++++++++---
 source4/libcli/smb2/session.c       |   22 ++++--
 source4/librpc/rpc/dcerpc_connect.c |    1 +
 source4/torture/smb2/durable_open.c |   82 ++++++++++++++++++++-
 source4/torture/smb2/session.c      |  143 +++++++++++++++++++++++++++++++++++
 source4/torture/smb2/smb2.c         |    1 +
 source4/torture/smb2/util.c         |   42 +++++++----
 source4/torture/smb2/wscript_build  |    2 +-
 14 files changed, 323 insertions(+), 53 deletions(-)
 create mode 100644 source4/torture/smb2/session.c


Changeset truncated at 500 lines:

diff --git a/selftest/knownfail b/selftest/knownfail
index e99f5d4..cc5d16b 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -69,7 +69,6 @@
 ^samba4.smb2.rename.share_delete_no_delete_access$
 ^samba4.smb2.rename.no_share_delete_no_delete_access$
 ^samba4.smb2.rename.msword
-^samba4.smb2.persistent.handles1
 ^samba4.winbind.struct.*.show_sequence     # Not yet working in winbind
 ^samba4.*base.delaywrite.*update of write time and SMBwrite truncate$
 ^samba4.*base.delaywrite.*update of write time and SMBwrite truncate expand$
diff --git a/selftest/skip b/selftest/skip
index 8ff2e60..f9bb83a 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -56,6 +56,7 @@
 ^samba4.smb2.lease
 ^samba4.smb2.durable.open
 ^samba4.smb2.dir
+^samba4.smb2.session
 ^samba4.ntvfs.cifs.*.base.charset
 ^samba4.ntvfs.cifs.*.base.iometer
 ^samba4.ntvfs.cifs.*.base.casetable
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 79b9496..9d4e4e1 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -1232,7 +1232,7 @@ static bool cli_sesssetup_blob_next(struct cli_sesssetup_blob_state *state,
 						    0, /* in_flags */
 						    SMB2_CAP_DFS, /* in_capabilities */
 						    0, /* in_channel */
-						    NULL, /* in_previous_session */
+						    0, /* in_previous_session_id */
 						    &state->smb2_blob);
 		if (subreq == NULL) {
 			return false;
diff --git a/source3/libsmb/smb2cli.h b/source3/libsmb/smb2cli.h
index 65e2f71..184bd10 100644
--- a/source3/libsmb/smb2cli.h
+++ b/source3/libsmb/smb2cli.h
@@ -32,7 +32,7 @@ struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
 				uint8_t in_flags,
 				uint32_t in_capabilities,
 				uint32_t in_channel,
-				struct smbXcli_session *in_previous_session,
+				uint64_t in_previous_session_id,
 				const DATA_BLOB *in_security_buffer);
 NTSTATUS smb2cli_session_setup_recv(struct tevent_req *req,
 				    TALLOC_CTX *mem_ctx,
diff --git a/source3/libsmb/smb2cli_session.c b/source3/libsmb/smb2cli_session.c
index d1d65f3..13412d1 100644
--- a/source3/libsmb/smb2cli_session.c
+++ b/source3/libsmb/smb2cli_session.c
@@ -46,7 +46,7 @@ struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
 				uint8_t in_flags,
 				uint32_t in_capabilities,
 				uint32_t in_channel,
-				struct smbXcli_session *in_previous_session,
+				uint64_t in_previous_session_id,
 				const DATA_BLOB *in_security_buffer)
 {
 	struct tevent_req *req, *subreq;
@@ -57,7 +57,6 @@ struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
 	uint8_t security_mode;
 	uint16_t security_buffer_offset = 0;
 	uint16_t security_buffer_length = 0;
-	uint64_t previous_session_id = 0;
 
 	req = tevent_req_create(mem_ctx, &state,
 				struct smb2cli_session_setup_state);
@@ -81,11 +80,6 @@ struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
 		security_buffer_length = in_security_buffer->length;
 	}
 
-	if (in_previous_session) {
-		previous_session_id =
-			smb2cli_session_current_id(in_previous_session);
-	}
-
 	buf = state->fixed;
 
 	SSVAL(buf,  0, 25);
@@ -95,7 +89,7 @@ struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
 	SIVAL(buf,  8, in_channel);
 	SSVAL(buf, 12, security_buffer_offset);
 	SSVAL(buf, 14, security_buffer_length);
-	SBVAL(buf, 16, previous_session_id);
+	SBVAL(buf, 16, in_previous_session_id);
 
 	if (security_buffer_length > 0) {
 		dyn = in_security_buffer->data;
diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c
index 5b37213..9334ab7 100644
--- a/source3/torture/test_smb2.c
+++ b/source3/torture/test_smb2.c
@@ -426,7 +426,8 @@ bool run_smb2_session_reconnect(int dummy)
 					    0x0, /* in_flags */
 					    SMB2_CAP_DFS, /* in_capabilities */
 					    0, /* in_channel */
-					    cli1->smb2.session, /* in_previous_session */
+					    /* in_previous_session_id: */
+					    smb2cli_session_current_id(cli1->smb2.session),
 					    &in_blob); /* in_security_buffer */
 	if (subreq == NULL) {
 		printf("smb2cli_session_setup_send() returned NULL\n");
@@ -460,7 +461,8 @@ bool run_smb2_session_reconnect(int dummy)
 					    0x0, /* in_flags */
 					    SMB2_CAP_DFS, /* in_capabilities */
 					    0, /* in_channel */
-					    cli1->smb2.session, /* in_previous_session */
+					    /* in_previous_session_id: */
+					    smb2cli_session_current_id(cli1->smb2.session),
 					    &in_blob); /* in_security_buffer */
 	if (subreq == NULL) {
 		printf("smb2cli_session_setup_send() returned NULL\n");
@@ -881,7 +883,7 @@ bool run_smb2_multi_channel(int dummy)
 					    0x01, /* in_flags */
 					    SMB2_CAP_DFS, /* in_capabilities */
 					    0, /* in_channel */
-					    NULL, /* in_previous_session */
+					    0, /* in_previous_session_id */
 					    &in_blob); /* in_security_buffer */
 	if (subreq == NULL) {
 		printf("smb2cli_session_setup_send() returned NULL\n");
@@ -915,7 +917,7 @@ bool run_smb2_multi_channel(int dummy)
 					    0x01, /* in_flags */
 					    SMB2_CAP_DFS, /* in_capabilities */
 					    0, /* in_channel */
-					    NULL, /* in_previous_session */
+					    0, /* in_previous_session_id */
 					    &in_blob); /* in_security_buffer */
 	if (subreq == NULL) {
 		printf("smb2cli_session_setup_send() returned NULL\n");
@@ -1143,7 +1145,7 @@ bool run_smb2_session_reauth(int dummy)
 					    0x0, /* in_flags */
 					    SMB2_CAP_DFS, /* in_capabilities */
 					    0, /* in_channel */
-					    NULL, /* in_previous_session */
+					    0, /* in_previous_session_id */
 					    &in_blob); /* in_security_buffer */
 	if (subreq == NULL) {
 		printf("smb2cli_session_setup_send() returned NULL\n");
@@ -1199,7 +1201,7 @@ bool run_smb2_session_reauth(int dummy)
 					    0x0, /* in_flags */
 					    SMB2_CAP_DFS, /* in_capabilities */
 					    0, /* in_channel */
-					    NULL, /* in_previous_session */
+					    0, /* in_previous_session_id */
 					    &in_blob); /* in_security_buffer */
 	if (subreq == NULL) {
 		printf("smb2cli_session_setup_send() returned NULL\n");
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index a6a5690..c743b90 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -35,6 +35,7 @@
 struct smb2_connect_state {
 	struct tevent_context *ev;
 	struct cli_credentials *credentials;
+	uint64_t previous_session_id;
 	struct resolve_context *resolve_ctx;
 	const char *host;
 	const char *share;
@@ -62,6 +63,7 @@ struct tevent_req *smb2_connect_send(TALLOC_CTX *mem_ctx,
 				     const char *share,
 				     struct resolve_context *resolve_ctx,
 				     struct cli_credentials *credentials,
+				     uint64_t previous_session_id,
 				     struct smbcli_options *options,
 				     const char *socket_options,
 				     struct gensec_settings *gensec_settings)
@@ -79,6 +81,7 @@ struct tevent_req *smb2_connect_send(TALLOC_CTX *mem_ctx,
 
 	state->ev = ev;
 	state->credentials = credentials;
+	state->previous_session_id = previous_session_id;
 	state->options = *options;
 	state->host = host;
 	state->ports = ports;
@@ -176,7 +179,8 @@ static void smb2_connect_negprot_done(struct tevent_req *subreq)
 
 	subreq = smb2_session_setup_spnego_send(state, state->ev,
 						state->session,
-						state->credentials);
+						state->credentials,
+						state->previous_session_id);
 	if (tevent_req_nomem(subreq, req)) {
 		return;
 	}
@@ -265,17 +269,18 @@ NTSTATUS smb2_connect_recv(struct tevent_req *req,
 /*
   sync version of smb2_connect
 */
-NTSTATUS smb2_connect(TALLOC_CTX *mem_ctx,
-		      const char *host,
-		      const char **ports,
-		      const char *share,
-		      struct resolve_context *resolve_ctx,
-		      struct cli_credentials *credentials,
-		      struct smb2_tree **tree,
-		      struct tevent_context *ev,
-		      struct smbcli_options *options,
-		      const char *socket_options,
-		      struct gensec_settings *gensec_settings)
+NTSTATUS smb2_connect_ext(TALLOC_CTX *mem_ctx,
+			  const char *host,
+			  const char **ports,
+			  const char *share,
+			  struct resolve_context *resolve_ctx,
+			  struct cli_credentials *credentials,
+			  uint64_t previous_session_id,
+			  struct smb2_tree **tree,
+			  struct tevent_context *ev,
+			  struct smbcli_options *options,
+			  const char *socket_options,
+			  struct gensec_settings *gensec_settings)
 {
 	struct tevent_req *subreq;
 	NTSTATUS status;
@@ -293,6 +298,7 @@ NTSTATUS smb2_connect(TALLOC_CTX *mem_ctx,
 				   share,
 				   resolve_ctx,
 				   credentials,
+				   previous_session_id,
 				   options,
 				   socket_options,
 				   gensec_settings);
@@ -318,3 +324,26 @@ NTSTATUS smb2_connect(TALLOC_CTX *mem_ctx,
 	TALLOC_FREE(frame);
 	return NT_STATUS_OK;
 }
+
+NTSTATUS smb2_connect(TALLOC_CTX *mem_ctx,
+		      const char *host,
+		      const char **ports,
+		      const char *share,
+		      struct resolve_context *resolve_ctx,
+		      struct cli_credentials *credentials,
+		      struct smb2_tree **tree,
+		      struct tevent_context *ev,
+		      struct smbcli_options *options,
+		      const char *socket_options,
+		      struct gensec_settings *gensec_settings)
+{
+	NTSTATUS status;
+
+	status = smb2_connect_ext(mem_ctx, host, ports, share, resolve_ctx,
+				  credentials,
+				  0, /* previous_session_id */
+				  tree, ev, options, socket_options,
+				  gensec_settings);
+
+	return status;
+}
diff --git a/source4/libcli/smb2/session.c b/source4/libcli/smb2/session.c
index 0974118..d727d55 100644
--- a/source4/libcli/smb2/session.c
+++ b/source4/libcli/smb2/session.c
@@ -75,6 +75,7 @@ struct smb2_session_setup_spnego_state {
 	struct tevent_context *ev;
 	struct smb2_session *session;
 	struct cli_credentials *credentials;
+	uint64_t previous_session_id;
 	NTSTATUS gensec_status;
 	DATA_BLOB in_secblob;
 	DATA_BLOB out_secblob;
@@ -85,10 +86,12 @@ static void smb2_session_setup_spnego_done(struct tevent_req *subreq);
 /*
   a composite function that does a full SPNEGO session setup
  */
-struct tevent_req *smb2_session_setup_spnego_send(TALLOC_CTX *mem_ctx,
-						  struct tevent_context *ev,
-						  struct smb2_session *session,
-						  struct cli_credentials *credentials)
+struct tevent_req *smb2_session_setup_spnego_send(
+				TALLOC_CTX *mem_ctx,
+				struct tevent_context *ev,
+				struct smb2_session *session,
+				struct cli_credentials *credentials,
+				uint64_t previous_session_id)
 {
 	struct tevent_req *req;
 	struct smb2_session_setup_spnego_state *state;
@@ -109,6 +112,7 @@ struct tevent_req *smb2_session_setup_spnego_send(TALLOC_CTX *mem_ctx,
 	state->ev = ev;
 	state->session = session;
 	state->credentials = credentials;
+	state->previous_session_id = previous_session_id;
 
 	server_gss_blob = smbXcli_conn_server_gss_blob(session->transport->conn);
 	if (server_gss_blob) {
@@ -159,7 +163,7 @@ struct tevent_req *smb2_session_setup_spnego_send(TALLOC_CTX *mem_ctx,
 					    0, /* in_flags */
 					    0, /* in_capabilities */
 					    0, /* in_channel */
-					    NULL, /* in_previous_session */
+					    state->previous_session_id,
 					    &state->in_secblob);
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
@@ -239,7 +243,7 @@ static void smb2_session_setup_spnego_done(struct tevent_req *subreq)
 					    0, /* in_flags */
 					    0, /* in_capabilities */
 					    0, /* in_channel */
-					    NULL, /* in_previous_session */
+					    state->previous_session_id,
 					    &state->in_secblob);
 	if (tevent_req_nomem(subreq, req)) {
 		return;
@@ -259,7 +263,8 @@ NTSTATUS smb2_session_setup_spnego_recv(struct tevent_req *req)
   sync version of smb2_session_setup_spnego
 */
 NTSTATUS smb2_session_setup_spnego(struct smb2_session *session, 
-				   struct cli_credentials *credentials)
+				   struct cli_credentials *credentials,
+				   uint64_t previous_session_id)
 {
 	struct tevent_req *subreq;
 	NTSTATUS status;
@@ -272,7 +277,8 @@ NTSTATUS smb2_session_setup_spnego(struct smb2_session *session,
 	}
 
 	subreq = smb2_session_setup_spnego_send(frame, ev,
-						session, credentials);
+						session, credentials,
+						previous_session_id);
 	if (subreq == NULL) {
 		TALLOC_FREE(frame);
 		return NT_STATUS_NO_MEMORY;
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c
index dc70736..634e3f4 100644
--- a/source4/librpc/rpc/dcerpc_connect.c
+++ b/source4/librpc/rpc/dcerpc_connect.c
@@ -255,6 +255,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(
 			"IPC$",
 			s->io.resolve_ctx,
 			s->io.creds,
+			0, /* previous_session_id */
 			&options,
 			lpcfg_socket_options(lp_ctx),
 			lpcfg_gensec_settings(mem_ctx, lp_ctx));
diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c
index 3d4744d..6a3f52b 100644
--- a/source4/torture/smb2/durable_open.c
+++ b/source4/torture/smb2/durable_open.c
@@ -24,6 +24,7 @@
 #include "libcli/smb2/smb2_calls.h"
 #include "torture/torture.h"
 #include "torture/smb2/proto.h"
+#include "../libcli/smb/smbXcli_base.h"
 
 #define CHECK_VAL(v, correct) do { \
 	if ((v) != (correct)) { \
@@ -448,6 +449,81 @@ done:
 }
 
 /**
+ * basic test for doing a durable open
+ * tcp disconnect, reconnect with a session reconnect and
+ * do a durable reopen (succeeds)
+ */
+bool test_durable_open_reopen2a(struct torture_context *tctx,
+			        struct smb2_tree *tree)
+{
+	NTSTATUS status;
+	TALLOC_CTX *mem_ctx = talloc_new(tctx);
+	char fname[256];
+	struct smb2_handle _h;
+	struct smb2_handle *h = NULL;
+	struct smb2_create io1, io2;
+	uint64_t previous_session_id;
+	bool ret = true;
+
+	/* Choose a random name in case the state is left a little funky. */
+	snprintf(fname, 256, "durable_open_reopen2_%s.dat",
+		 generate_random_str(tctx, 8));
+
+	smb2_util_unlink(tree, fname);
+
+	smb2_oplock_create_share(&io1, fname,
+				 smb2_util_share_access(""),
+				 smb2_util_oplock_level("b"));
+	io1.in.durable_open = true;
+
+	status = smb2_create(tree, mem_ctx, &io1);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	_h = io1.out.file.handle;
+	h = &_h;
+	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
+	CHECK_VAL(io1.out.durable_open, true);
+	CHECK_VAL(io1.out.oplock_level, smb2_util_oplock_level("b"));
+
+	/* disconnect, reconnect and then do durable reopen */
+	previous_session_id = smb2cli_session_current_id(tree->session->smbXcli);
+	talloc_free(tree);
+	tree = NULL;
+
+	if (!torture_smb2_connection_ext(tctx, previous_session_id, &tree)) {
+		torture_warning(tctx, "couldn't reconnect, bailing\n");
+		ret = false;
+		goto done;
+	}
+
+	ZERO_STRUCT(io2);
+	io2.in.fname = fname;
+	io2.in.durable_handle = h;
+	h = NULL;
+
+	status = smb2_create(tree, mem_ctx, &io2);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
+	CHECK_VAL(io2.out.durable_open, true);
+	CHECK_VAL(io2.out.oplock_level, smb2_util_oplock_level("b"));
+	_h = io2.out.file.handle;
+	h = &_h;
+
+done:
+	if (h != NULL) {
+		smb2_util_close(tree, *h);
+	}
+
+	smb2_util_unlink(tree, fname);
+
+	talloc_free(tree);
+
+	talloc_free(mem_ctx);
+
+	return ret;
+}
+
+
+/**
  * basic test for doing a durable open:
  * tdis, new tcon, try durable reopen (fails)
  */
@@ -560,7 +636,10 @@ bool test_durable_open_reopen4(struct torture_context *tctx,
 	status = smb2_logoff(tree->session);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
-	if (!torture_smb2_session_setup(tctx, transport, mem_ctx, &session2)) {
+	if (!torture_smb2_session_setup(tctx, transport,
+					0, /* previous_session_id */
+					mem_ctx, &session2))
+	{
 		torture_warning(tctx, "session setup failed.\n");
 		ret = false;
 		goto done;
@@ -1170,6 +1249,7 @@ struct torture_suite *torture_smb2_durable_open_init(void)
 	torture_suite_add_1smb2_test(suite, "open2", test_durable_open_open2);
 	torture_suite_add_1smb2_test(suite, "reopen1", test_durable_open_reopen1);
 	torture_suite_add_1smb2_test(suite, "reopen2", test_durable_open_reopen2);
+	torture_suite_add_1smb2_test(suite, "reopen2a", test_durable_open_reopen2a);
 	torture_suite_add_1smb2_test(suite, "reopen3", test_durable_open_reopen3);
 	torture_suite_add_1smb2_test(suite, "reopen4", test_durable_open_reopen4);
 	torture_suite_add_2smb2_test(suite, "file-position",
diff --git a/source4/torture/smb2/session.c b/source4/torture/smb2/session.c
new file mode 100644
index 0000000..11a5a5d
--- /dev/null
+++ b/source4/torture/smb2/session.c
@@ -0,0 +1,143 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   test suite for SMB2 session setups
+
+   Copyright (C) Michael Adam 2012
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "libcli/smb2/smb2.h"
+#include "libcli/smb2/smb2_calls.h"
+#include "torture/torture.h"
+#include "torture/smb2/proto.h"
+#include "../libcli/smb/smbXcli_base.h"
+
+#define CHECK_VAL(v, correct) do { \
+	if ((v) != (correct)) { \
+		torture_result(tctx, TORTURE_FAIL, "(%s): wrong value for %s got 0x%x - should be 0x%x\n", \
+				__location__, #v, (int)v, (int)correct); \
+		ret = false; \
+	}} while (0)
+
+#define CHECK_STATUS(status, correct) do { \
+	if (!NT_STATUS_EQUAL(status, correct)) { \
+		torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \


-- 
Samba Shared Repository


More information about the samba-cvs mailing list