From 9f08cc8c7a864ad702b723a7176ab80aa3fe225a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 18 Mar 2013 13:50:28 +0100 Subject: [PATCH 1/2] TODO s3:smbd: truncate reads to 0x10000 as Windows does TODO do we want that, I think it makes it easier to compare camptures... --- source3/smbd/reply.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 8b500c5..1501a14 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3902,6 +3902,14 @@ static size_t calc_read_size(const struct smb_request *req, size_t hdr_len = MIN_SMB_SIZE + VWV(12); size_t max_len = max_pdu - hdr_len; + if (!lp_unix_extensions()) { + /* + * Windows limits large reads to + * 0x10000. + */ + max_len = MIN(max_len, 0x10000); + } + /* * Windows explicitly ignores upper size of 0xFFFF. * See [MS-SMB].pdf <26> Section 2.2.4.2.1: -- 1.7.9.5 From ebd7f6eeec61eec2dcc5d3d6643c4b5df593255f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 20 Mar 2013 08:46:59 +0100 Subject: [PATCH 2/2] s4:torture: let raw.read expect large reads with CAP_UNIX Signed-off-by: Stefan Metzmacher --- source4/torture/raw/read.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c index 59089bf..f5f2bb4 100644 --- a/source4/torture/raw/read.c +++ b/source4/torture/raw/read.c @@ -524,8 +524,8 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(io.readx.out.remaining, 0xFFFF); CHECK_VALUE(io.readx.out.compaction_mode, 0); - if (io.readx.out.nread == io.readx.in.maxcnt) { - printf("SAMBA: large read extension\n"); + if (cli->transport->negotiate.capabilities & CAP_UNIX) { + printf("UNIX: large read\n"); CHECK_VALUE(io.readx.out.nread, 80000); } else { CHECK_VALUE(io.readx.out.nread, 0x10000); @@ -573,8 +573,8 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) io.readx.in.maxcnt = 0x10001; status = smb_raw_read(cli->tree, &io); CHECK_STATUS(status, NT_STATUS_OK); - if (io.readx.out.nread == io.readx.in.maxcnt) { - printf("SAMBA: large read extension\n"); + if (cli->transport->negotiate.capabilities & CAP_UNIX) { + printf("UNIX: large read\n"); CHECK_VALUE(io.readx.out.nread, 0x10001); } else { CHECK_VALUE(io.readx.out.nread, 0x10000); -- 1.7.9.5