The branch, master has been updated via f0c43ce dbwrap_file: fix use of read_data() via 32e545e s4-torture: let smb2.replay.replay4 test deal with scale out shares. via 757ade6 s4-torture: let smb2.replay.replay3 test deal with scale out shares. via 9c23f43 s4-torture: let smb2.replay.replay2 test deal with scale out shares. from 07bb954 VERSION: Bump version up to 4.5.0pre1
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit f0c43ceec5185ef4bc429e201339f3eb3e7c094b Author: Uri Simchoni <u...@samba.org> Date: Thu Jan 21 13:18:20 2016 +0200 dbwrap_file: fix use of read_data() Signed-off-by: Uri Simchoni <u...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Wed Jan 27 00:09:05 CET 2016 on sn-devel-144 commit 32e545ecea4f217c8b723fbea5d9131573a50488 Author: Günther Deschner <g...@samba.org> Date: Fri Jan 15 18:30:15 2016 +0100 s4-torture: let smb2.replay.replay4 test deal with scale out shares. Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 757ade67e6830ed66eeeb4954d1fd24d83effb13 Author: Günther Deschner <g...@samba.org> Date: Fri Jan 15 18:24:08 2016 +0100 s4-torture: let smb2.replay.replay3 test deal with scale out shares. Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 9c23f43f9edd8cfbfdd56e397748e2f74b1ef29b Author: Günther Deschner <g...@samba.org> Date: Fri Jan 15 18:07:31 2016 +0100 s4-torture: let smb2.replay.replay2 test deal with scale out shares. Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/dbwrap/dbwrap_file.c | 11 +++--- source4/torture/smb2/replay.c | 80 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 68 insertions(+), 23 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/dbwrap/dbwrap_file.c b/lib/dbwrap/dbwrap_file.c index a3b1737..46e62c8 100644 --- a/lib/dbwrap/dbwrap_file.c +++ b/lib/dbwrap/dbwrap_file.c @@ -171,7 +171,7 @@ static struct db_record *db_file_fetch_locked(struct db_context *db, result->value.dptr = NULL; if (statbuf.st_ex_size != 0) { - NTSTATUS status; + ssize_t read_bytes; result->value.dsize = statbuf.st_ex_size; result->value.dptr = talloc_array(result, uint8_t, @@ -182,11 +182,10 @@ static struct db_record *db_file_fetch_locked(struct db_context *db, return NULL; } - status = read_data(file->fd, (char *)result->value.dptr, - result->value.dsize); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(3, ("read_data failed: %s\n", - nt_errstr(status))); + read_bytes = read_data(file->fd, (char *)result->value.dptr, + result->value.dsize); + if (read_bytes != result->value.dsize) { + DEBUG(3, ("read_data failed: %s\n", strerror(errno))); TALLOC_FREE(result); return NULL; } diff --git a/source4/torture/smb2/replay.c b/source4/torture/smb2/replay.c index 57b14f1..4b3f569 100644 --- a/source4/torture/smb2/replay.c +++ b/source4/torture/smb2/replay.c @@ -302,12 +302,17 @@ static bool test_replay2(struct torture_context *tctx, struct smb2_tree *tree) bool ret = true; const char *fname = BASEDIR "\\replay2.dat"; struct smb2_transport *transport = tree->session->transport; + uint32_t share_capabilities; + bool share_is_so; if (smbXcli_conn_protocol(transport->conn) < PROTOCOL_SMB3_00) { torture_skip(tctx, "SMB 3.X Dialect family required for " "replay tests\n"); } + share_capabilities = smb2cli_tcon_capabilities(tree->smbXcli); + share_is_so = share_capabilities & SMB2_SHARE_CAP_SCALEOUT; + ZERO_STRUCT(break_info); break_info.tctx = tctx; tree->session->transport->oplock.handler = torture_oplock_ack_handler; @@ -336,10 +341,16 @@ static bool test_replay2(struct torture_context *tctx, struct smb2_tree *tree) _h = io.out.file.handle; h = &_h; CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE); - CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b")); CHECK_VAL(io.out.durable_open, false); - CHECK_VAL(io.out.durable_open_v2, true); - CHECK_VAL(io.out.timeout, io.in.timeout); + if (share_is_so) { + CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("s")); + CHECK_VAL(io.out.durable_open_v2, false); + CHECK_VAL(io.out.timeout, 0); + } else { + CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b")); + CHECK_VAL(io.out.durable_open_v2, true); + CHECK_VAL(io.out.timeout, io.in.timeout); + } /* * Replay Durable V2 Create on single channel @@ -392,10 +403,13 @@ static bool test_replay2(struct torture_context *tctx, struct smb2_tree *tree) io.in.durable_open_v2 = false; status = smb2_create(tree, mem_ctx, &io); CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION); - CHECK_VAL(break_info.count, 1); - CHECK_HANDLE(&break_info.handle, &ref1.out.file.handle); - CHECK_VAL(break_info.level, smb2_util_oplock_level("s")); - ZERO_STRUCT(break_info); + + if (!share_is_so) { + CHECK_VAL(break_info.count, 1); + CHECK_HANDLE(&break_info.handle, &ref1.out.file.handle); + CHECK_VAL(break_info.level, smb2_util_oplock_level("s")); + ZERO_STRUCT(break_info); + } smb2_util_close(tree, *h); h = NULL; @@ -471,12 +485,17 @@ static bool test_replay3(struct torture_context *tctx, struct smb2_tree *tree1) struct smb2_transport *transport2 = NULL; struct smb2_session *session1_1 = tree1->session; struct smb2_session *session1_2 = NULL; + uint32_t share_capabilities; + bool share_is_so; if (smbXcli_conn_protocol(transport1->conn) < PROTOCOL_SMB3_00) { torture_skip(tctx, "SMB 3.X Dialect family required for " "Replay tests\n"); } + share_capabilities = smb2cli_tcon_capabilities(tree1->smbXcli); + share_is_so = share_capabilities & SMB2_SHARE_CAP_SCALEOUT; + ZERO_STRUCT(break_info); break_info.tctx = tctx; transport1->oplock.handler = torture_oplock_ack_handler; @@ -508,10 +527,16 @@ static bool test_replay3(struct torture_context *tctx, struct smb2_tree *tree1) _h = io.out.file.handle; h = &_h; CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE); - CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b")); + if (share_is_so) { + CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("s")); + CHECK_VAL(io.out.durable_open_v2, false); + CHECK_VAL(io.out.timeout, 0); + } else { + CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b")); + CHECK_VAL(io.out.durable_open_v2, true); + CHECK_VAL(io.out.timeout, io.in.timeout); + } CHECK_VAL(io.out.durable_open, false); - CHECK_VAL(io.out.durable_open_v2, true); - CHECK_VAL(io.out.timeout, io.in.timeout); CHECK_VAL(break_info.count, 0); status = smb2_connect(tctx, @@ -557,10 +582,16 @@ static bool test_replay3(struct torture_context *tctx, struct smb2_tree *tree1) _h = io.out.file.handle; h = &_h; CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE); - CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b")); + if (share_is_so) { + CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("s")); + CHECK_VAL(io.out.durable_open_v2, false); + CHECK_VAL(io.out.timeout, 0); + } else { + CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b")); + CHECK_VAL(io.out.durable_open_v2, true); + CHECK_VAL(io.out.timeout, io.in.timeout); + } CHECK_VAL(io.out.durable_open, false); - CHECK_VAL(io.out.durable_open_v2, true); - CHECK_VAL(io.out.timeout, io.in.timeout); CHECK_VAL(break_info.count, 0); tree1->session = session1_1; @@ -609,12 +640,17 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1) struct smb2_session *session1_1 = tree1->session; struct smb2_session *session1_2 = NULL; uint16_t curr_cs; + uint32_t share_capabilities; + bool share_is_so; if (smbXcli_conn_protocol(transport1->conn) < PROTOCOL_SMB3_00) { torture_skip(tctx, "SMB 3.X Dialect family required for " "Replay tests\n"); } + share_capabilities = smb2cli_tcon_capabilities(tree1->smbXcli); + share_is_so = share_capabilities & SMB2_SHARE_CAP_SCALEOUT; + ZERO_STRUCT(break_info); break_info.tctx = tctx; transport1->oplock.handler = torture_oplock_ack_handler; @@ -646,10 +682,16 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1) _h1 = io.out.file.handle; h1 = &_h1; CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE); - CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b")); + if (share_is_so) { + CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("s")); + CHECK_VAL(io.out.durable_open_v2, false); + CHECK_VAL(io.out.timeout, 0); + } else { + CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b")); + CHECK_VAL(io.out.durable_open_v2, true); + CHECK_VAL(io.out.timeout, io.in.timeout); + } CHECK_VAL(io.out.durable_open, false); - CHECK_VAL(io.out.durable_open_v2, true); - CHECK_VAL(io.out.timeout, io.in.timeout); CHECK_VAL(break_info.count, 0); status = smb2_util_write(tree1, *h1, buf, 0, ARRAY_SIZE(buf)); @@ -790,7 +832,11 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1) smb2_util_close(tree1, *h1); h1 = NULL; - CHECK_VAL(break_info.count, 0); + if (share_is_so) { + CHECK_VAL(break_info.count, 1); + } else { + CHECK_VAL(break_info.count, 0); + } done: talloc_free(tree2); tree1->session = session1_1; -- Samba Shared Repository