[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Fri Sep 7 02:48:01 MDT 2012


The branch, master has been updated
       via  51a3845 selftest/knownfail: samba3.smb2.durable-open.alloc-size fails currently
       via  972bf34 s4:torture:smb2: add a test for alloc size behaviour under durable reconnect
       via  36ea4ec param: remove unused define FN_LOCAL_PARM_CHAR()
      from  d0159f6 Free protect_ids in secret_store_domain_guid() as the caller of fetch_secrets() must free the result in order to not leak memory.

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


- Log -----------------------------------------------------------------
commit 51a3845190ce1a804c82f652029146d432a7f7b2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 7 08:54:08 2012 +0200

    selftest/knownfail: samba3.smb2.durable-open.alloc-size fails currently
    
    metze
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Fri Sep  7 10:47:29 CEST 2012 on sn-devel-104

commit 972bf34332ac00edf89c746a0a1f25e5cf52ca94
Author: Michael Adam <obnox at samba.org>
Date:   Fri Sep 7 00:53:38 2012 +0200

    s4:torture:smb2: add a test for alloc size behaviour under durable reconnect
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

commit 36ea4ec4eb3123e355c688e17dac4f294394093e
Author: Michael Adam <obnox at samba.org>
Date:   Thu Sep 6 12:43:47 2012 +0200

    param: remove unused define FN_LOCAL_PARM_CHAR()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 lib/param/loadparm.c                |    2 -
 selftest/knownfail                  |    1 +
 source4/torture/smb2/durable_open.c |  154 +++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 3814087..d4318a4 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -313,8 +313,6 @@ static struct loadparm_context *global_loadparm_context;
 
 #define FN_LOCAL_PARM_INTEGER(fn_name, val) FN_LOCAL_INTEGER(fn_name, val)
 
-#define FN_LOCAL_PARM_CHAR(fn_name, val) FN_LOCAL_CHAR(fn_name, val)
-
 #define FN_LOCAL_CHAR(fn_name,val) \
  _PUBLIC_ char lpcfg_ ## fn_name(struct loadparm_service *service, \
 				struct loadparm_service *sDefault) {	\
diff --git a/selftest/knownfail b/selftest/knownfail
index 30c66b8..b81dbfb 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -176,6 +176,7 @@
 ^samba3.smb2.notify.dir
 ^samba3.smb2.notify.rec
 ^samba3.smb2.durable-open.file-position
+^samba3.smb2.durable-open.alloc-size
 ^samba3.smb2.durable-open.lease
 ^samba3.smb2.durable-open.lock-oplock
 ^samba3.smb2.durable-open.lock-lease
diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c
index 8524fd6..c42588a 100644
--- a/source4/torture/smb2/durable_open.c
+++ b/source4/torture/smb2/durable_open.c
@@ -59,6 +59,16 @@
 		CHECK_VAL((__io)->out.reserved2, 0);			\
 	} while(0)
 
+#define CHECK_CREATED_SIZE(__io, __created, __attribute, __alloc_size, __size)	\
+	do {									\
+		CHECK_VAL((__io)->out.create_action, NTCREATEX_ACTION_ ## __created); \
+		CHECK_VAL((__io)->out.alloc_size, (__alloc_size));		\
+		CHECK_VAL((__io)->out.size, (__size));				\
+		CHECK_VAL((__io)->out.file_attr, (__attribute));		\
+		CHECK_VAL((__io)->out.reserved2, 0);				\
+	} while(0)
+
+
 
 /**
  * basic durable_open test.
@@ -1458,6 +1468,148 @@ bool test_durable_open_open2_oplock(struct torture_context *tctx,
 	return ret;
 }
 
+/**
+ * test behaviour with initial allocation size
+ */
+bool test_durable_open_alloc_size(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 io;
+	bool ret = true;
+	uint64_t previous_session_id;
+	uint64_t alloc_size_step;
+	uint64_t initial_alloc_size = 0x100;
+	const uint8_t *b = NULL;
+
+	/* Choose a random name in case the state is left a little funky. */
+	snprintf(fname, 256, "durable_open_initial_alloc_%s.dat",
+		 generate_random_str(tctx, 8));
+
+	smb2_util_unlink(tree, fname);
+
+	smb2_oplock_create_share(&io, fname,
+				 smb2_util_share_access(""),
+				 smb2_util_oplock_level("b"));
+	io.in.durable_open = true;
+	io.in.alloc_size = initial_alloc_size;
+
+	status = smb2_create(tree, mem_ctx, &io);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	_h = io.out.file.handle;
+	h = &_h;
+	CHECK_NOT_VAL(io.out.alloc_size, 0);
+	alloc_size_step = io.out.alloc_size;
+	CHECK_CREATED_SIZE(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE,
+			   alloc_size_step, 0);
+	CHECK_VAL(io.out.durable_open, true);
+	CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b"));
+
+	/* prepare buffer */
+	b = talloc_zero_size(mem_ctx, alloc_size_step);
+	CHECK_NOT_VAL(b, NULL);
+
+	previous_session_id = smb2cli_session_current_id(tree->session->smbXcli);
+
+	/* disconnect, reconnect and then do durable reopen */
+	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(io);
+	io.in.fname = fname;
+	io.in.durable_handle = h;
+	h = NULL;
+
+	status = smb2_create(tree, mem_ctx, &io);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	CHECK_CREATED_SIZE(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE,
+			   alloc_size_step, 0);
+	CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b"));
+	_h = io.out.file.handle;
+	h = &_h;
+
+	previous_session_id = smb2cli_session_current_id(tree->session->smbXcli);
+
+	/* write one byte */
+	status = smb2_util_write(tree, *h, b, 0, 1);
+	CHECK_STATUS(status, NT_STATUS_OK);
+
+	/* disconnect, reconnect and then do durable reopen */
+	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(io);
+	io.in.fname = fname;
+	io.in.durable_handle = h;
+	h = NULL;
+
+	status = smb2_create(tree, mem_ctx, &io);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	CHECK_CREATED_SIZE(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE,
+			   alloc_size_step, 1);
+	CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b"));
+	_h = io.out.file.handle;
+	h = &_h;
+
+	previous_session_id = smb2cli_session_current_id(tree->session->smbXcli);
+
+	/* write more byte than initial allocation size */
+	status = smb2_util_write(tree, *h, b, 1, alloc_size_step);
+
+	/* disconnect, reconnect and then do durable reopen */
+	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(io);
+	io.in.fname = fname;
+	io.in.durable_handle = h;
+	h = NULL;
+
+	status = smb2_create(tree, mem_ctx, &io);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	CHECK_CREATED_SIZE(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE,
+			   alloc_size_step * 2, alloc_size_step + 1);
+	CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b"));
+	_h = io.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;
+}
+
+
 struct torture_suite *torture_smb2_durable_open_init(void)
 {
 	struct torture_suite *suite =
@@ -1482,6 +1634,8 @@ struct torture_suite *torture_smb2_durable_open_init(void)
 				     test_durable_open_open2_lease);
 	torture_suite_add_2smb2_test(suite, "open2-oplock",
 				     test_durable_open_open2_oplock);
+	torture_suite_add_1smb2_test(suite, "alloc-size",
+				     test_durable_open_alloc_size);
 
 	suite->description = talloc_strdup(suite, "SMB2-DURABLE-OPEN tests");
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list