The branch, master has been updated via 162fbf4 selftest: skip the samba4.smb2.compound testsuite via 93bee9b s3:smbd:smb2: initialize variable in vfs_default_durable_reconnect() via 8419346 selftest: we fail samba3.smb2.compound.interim2 via 6f6b1c6 s4:torture:smb2:compound: remove two unused macros via 8df0b02 s4:torture:smb2: don't skip the compound.interim2 test for non win7/win2k8 via 917e714 s4:torture:smb2: don't skip the compound.interim1 test for non win7/win2k8 via 88d051f s3:smbd: remove struct member smbd_smb2_request.cancelled - it was only written via 603f9bf s3:smb2_lock: let smbd_smb2_create_cancel() trigger NT_STATUS_CANCELED via 65a8106 s3:smb2_lock: smbd_smb2_notify_recv() can already return NT_STATUS_CANCELED via 882cee0 s3:smb2_notify: make use of tevent_req_defer_callback() instead of custom tevent_immediate via 1f0dfd4 s3:smb2_notify: don't call tevent_req_done() from smbd_smb2_notify_cancel() via 1f8e473 s3:smb2_lock: let smbd_smb2_lock_cancel() trigger NT_STATUS_CANCELED via 9249871 s3:smb2_server: avoid segfault in smbd_smb2_request_pending_queue() via 25437df s4:torture:smb2: extend the compound.invalid1 test via 1ae6f9c s3:smbd:smb2: simplify smbd_smb2_request_validate() and smbd_smb2_request_dispatch() via 27d38b5 s3:smbd:smb2: add check for session_status for compound requests via 4384485 s3:smb2_server: do the req->next_status check before the signing checks via 2552b66 s3:smb2_server: reset req->last_session_id and req->last_tid after using it via bd8d50b s4:torture:smb2: fix the compound.invalid3 test to work against windows via 8e525a2 s4:torture:smb2: fix compound.related3 test to work against windows via 7595194 s3: Compound requests should continue processing. from fe2071c build: Fix enabled handling for HAVE_LDAP, we need to use bld.CONFIG_SET
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 162fbf4adbd78af0ca62e01da30e9c8bf86d3b4d Author: Michael Adam <ob...@samba.org> Date: Sat Sep 22 19:07:51 2012 +0200 selftest: skip the samba4.smb2.compound testsuite Too many tests are starting but never finish. Autobuild-User(master): Michael Adam <ob...@samba.org> Autobuild-Date(master): Sat Sep 22 20:50:06 CEST 2012 on sn-devel-104 commit 93bee9b3e31b398b9becc7be7804025d4066359b Author: Michael Adam <ob...@samba.org> Date: Fri Sep 21 22:56:20 2012 +0200 s3:smbd:smb2: initialize variable in vfs_default_durable_reconnect() Found by Ambi's state-of-the-art compiler! commit 841934647b06d6400148932cc8ce02a20c209610 Author: Michael Adam <ob...@samba.org> Date: Thu Sep 20 20:46:53 2012 +0200 selftest: we fail samba3.smb2.compound.interim2 We currently return NT_STATUS_CANCELLED where we should return NT_STATUS_INTERNAL_ERROR. commit 6f6b1c6ac15f225978e8c2d67c1a817d9e098317 Author: Michael Adam <ob...@samba.org> Date: Thu Sep 20 00:43:54 2012 +0200 s4:torture:smb2:compound: remove two unused macros commit 8df0b023c51ed198d3054760447e1b273eada991 Author: Michael Adam <ob...@samba.org> Date: Thu Sep 20 00:41:48 2012 +0200 s4:torture:smb2: don't skip the compound.interim2 test for non win7/win2k8 commit 917e714831178b2a3d07c7f9d09711231a7ccf31 Author: Michael Adam <ob...@samba.org> Date: Thu Sep 20 00:41:04 2012 +0200 s4:torture:smb2: don't skip the compound.interim1 test for non win7/win2k8 commit 88d051f7f18ff88ec5385fdc798f051659134bd3 Author: Michael Adam <ob...@samba.org> Date: Sat Sep 22 02:05:18 2012 +0200 s3:smbd: remove struct member smbd_smb2_request.cancelled - it was only written commit 603f9bfa4cf7910e1c1cae1a8d0741a6d0874baa Author: Stefan Metzmacher <me...@samba.org> Date: Thu Sep 20 16:16:03 2012 +0200 s3:smb2_lock: let smbd_smb2_create_cancel() trigger NT_STATUS_CANCELED Instead of violating the tevent_req layers. metze commit 65a81060093cf9d7c0ebf8d6e160625bdc87baab Author: Stefan Metzmacher <me...@samba.org> Date: Thu Sep 20 16:16:03 2012 +0200 s3:smb2_lock: smbd_smb2_notify_recv() can already return NT_STATUS_CANCELED That's why we can remove the code that violates the tevent_req layers. metze commit 882cee0acb9c1e2105a005f0ea90691197a696c7 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Sep 20 16:25:58 2012 +0200 s3:smb2_notify: make use of tevent_req_defer_callback() instead of custom tevent_immediate metze commit 1f0dfd42f16c388abc7054a7b615d2e81031472b Author: Stefan Metzmacher <me...@samba.org> Date: Thu Sep 20 16:23:26 2012 +0200 s3:smb2_notify: don't call tevent_req_done() from smbd_smb2_notify_cancel() smbd_notify_cancel_by_smbreq() will already trigger this via smbd_smb2_notify_reply() and smbd_smb2_notify_reply_trigger(). metze commit 1f8e4732c5870043fbbc22c772404b5380f808f0 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Sep 20 16:16:03 2012 +0200 s3:smb2_lock: let smbd_smb2_lock_cancel() trigger NT_STATUS_CANCELED Instead of violating the tevent_req layers. metze commit 9249871f40aab021d62d3154f8ca286b52f5ef76 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Sep 20 16:04:01 2012 +0200 s3:smb2_server: avoid segfault in smbd_smb2_request_pending_queue() Because we should not call smbd_smb2_request_error() on an request that is still running. If the subreq implementes a cancel function, this should take care of triggering smbd_smb2_request_error. metze Signed-off-by: Michael Adam <ob...@samba.org> commit 25437df8a65e56616499dda18c696f58be08f67a Author: Stefan Metzmacher <me...@samba.org> Date: Fri Sep 21 22:20:20 2012 +0200 s4:torture:smb2: extend the compound.invalid1 test Test that when turning the related flag back off for the last compound request, the return code changes from invalid parameter to file closed. Pair-Programmed-With: Michael Adam <ob...@samba.org> commit 1ae6f9c62629f8513bbe93a56775b3c64ff06832 Author: Michael Adam <ob...@samba.org> Date: Fri Sep 21 21:43:36 2012 +0200 s3:smbd:smb2: simplify smbd_smb2_request_validate() and smbd_smb2_request_dispatch() removes unnneccary checks/assignments for compound_related and next_status and duplicate setting of error status. And remove (now) unused next_status from struct smbd_smb2_request. Pair-Programmed-With: Stefan Metzmacher <me...@samba.org> commit 27d38b5c27bd96d5124c175d946718bf0836b8f4 Author: Michael Adam <ob...@samba.org> Date: Sat Sep 22 04:06:27 2012 +0200 s3:smbd:smb2: add check for session_status for compound requests commit 4384485f82aac109bf4c4c31075e313e54b4c076 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Sep 20 00:52:19 2012 +0200 s3:smb2_server: do the req->next_status check before the signing checks Windows 2012 returns NT_STATUS_INVALID_PARAMETER to the smb2.compound.invalid1 test if that uses signing (instead of NT_STATUS_ACCESS_DENIED). metze commit 2552b6632372b35cbd7b788c4e00091dfe520a41 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Sep 20 05:10:28 2012 +0200 s3:smb2_server: reset req->last_session_id and req->last_tid after using it If we can find a valid session or tcon we'll set it after the lookup, but it need to make sure to reset it if we don't find the session. This fixes a problem where a compound unrelated request between related requests doesn't reset the session. If we have 3 requests in a compound chain, request 3 should never use the id's cached from request 1. It should only every inherit handles from request 2. metze commit bd8d50b451ea7f94efa7777fbe5dc0c2c19f6bf9 Author: Michael Adam <ob...@samba.org> Date: Thu Sep 20 00:36:29 2012 +0200 s4:torture:smb2: fix the compound.invalid3 test to work against windows commit 8e525a29a7c6512f61e4647ecb2e0771e2019a49 Author: Michael Adam <ob...@samba.org> Date: Thu Sep 20 00:35:52 2012 +0200 s4:torture:smb2: fix compound.related3 test to work against windows commit 75951946193c874b6db30c1b9c8722264c3ce656 Author: Ira Cooper <i...@samba.org> Date: Wed Sep 19 18:39:07 2012 +0000 s3: Compound requests should continue processing. This patch addresses #9173. Signed-off-by: Michael Adam <ob...@samba.org> ----------------------------------------------------------------------- Summary of changes: selftest/knownfail | 1 + selftest/skip | 1 + source3/smbd/durable.c | 2 +- source3/smbd/globals.h | 3 - source3/smbd/smb2_create.c | 17 +------ source3/smbd/smb2_lock.c | 30 +----------- source3/smbd/smb2_notify.c | 55 +----------------------- source3/smbd/smb2_read.c | 2 - source3/smbd/smb2_server.c | 91 +++++++++++---------------------------- source3/smbd/smb2_write.c | 2 - source4/torture/smb2/compound.c | 30 +++++-------- 11 files changed, 47 insertions(+), 187 deletions(-) Changeset truncated at 500 lines: diff --git a/selftest/knownfail b/selftest/knownfail index 59fa2ee..f6835f6 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -204,6 +204,7 @@ ^samba3.smb2.getinfo.getinfo ^samba3.smb2.setinfo.setinfo ^samba3.smb2.session.*reauth5 # some special anonymous checks? +^samba3.smb2.compound.interim2 # wrong return code (STATUS_CANCELLED) ^samba3.raw.session.*reauth2 # maybe fix this? ^samba3.rpc.spoolss.printer.addprinter.driver_info_winreg # knownfail or flapping? ^samba3.rpc.spoolss.printer.addprinterex.driver_info_winreg # knownfail or flapping? diff --git a/selftest/skip b/selftest/skip index 174f257..171eee0 100644 --- a/selftest/skip +++ b/selftest/skip @@ -57,6 +57,7 @@ ^samba4.smb2.durable-v2-open ^samba4.smb2.dir ^samba4.smb2.session +^samba4.smb2.compound ^samba4.ntvfs.cifs.*.base.charset ^samba4.ntvfs.cifs.*.base.iometer ^samba4.ntvfs.cifs.*.base.casetable diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c index 5953e1b..42ad18e 100644 --- a/source3/smbd/durable.c +++ b/source3/smbd/durable.c @@ -234,7 +234,7 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn, NTSTATUS status; bool ok; int ret; - int flags; + int flags = 0; struct file_id file_id; struct smb_filename *smb_fname = NULL; enum ndr_err_code ndr_err; diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 74e42c7..107d338 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -466,7 +466,6 @@ struct smbd_smb2_request { bool do_signing; bool do_encryption; struct tevent_timer *async_te; - bool cancelled; bool compound_related; /* @@ -486,8 +485,6 @@ struct smbd_smb2_request { struct smb_request *smb1req; struct files_struct *compat_chain_fsp; - NTSTATUS next_status; - /* * The sub request for async backend calls. * This is used for SMB2 Cancel. diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index 0d9a146..9318a83 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -284,19 +284,6 @@ static void smbd_smb2_request_create_done(struct tevent_req *tsubreq) NTSTATUS status; NTSTATUS error; /* transport error */ - if (smb2req->cancelled) { - uint64_t mid = get_mid_from_smb2req(smb2req); - DEBUG(10,("smbd_smb2_request_create_done: cancelled mid %llu\n", - (unsigned long long)mid )); - error = smbd_smb2_request_error(smb2req, NT_STATUS_CANCELLED); - if (!NT_STATUS_IS_OK(error)) { - smbd_server_connection_terminate(smb2req->sconn, - nt_errstr(error)); - return; - } - return; - } - status = smbd_smb2_create_recv(tsubreq, smb2req, &out_oplock_level, @@ -1425,9 +1412,9 @@ static bool smbd_smb2_create_cancel(struct tevent_req *req) remove_deferred_open_entry(state->id, mid, messaging_server_id(smb2req->sconn->msg_ctx)); remove_deferred_open_message_smb2_internal(smb2req, mid); - smb2req->cancelled = true; - tevent_req_done(req); + tevent_req_defer_callback(req, smb2req->sconn->ev_ctx); + tevent_req_nterror(req, NT_STATUS_CANCELLED); return true; } diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c index 19e1ef0..e2ea251 100644 --- a/source3/smbd/smb2_lock.c +++ b/source3/smbd/smb2_lock.c @@ -134,31 +134,6 @@ static void smbd_smb2_request_lock_done(struct tevent_req *subreq) NTSTATUS status; NTSTATUS error; /* transport error */ - if (smb2req->cancelled) { - const uint8_t *inhdr = SMBD_SMB2_IN_HDR_PTR(smb2req); - uint64_t mid = BVAL(inhdr, SMB2_HDR_MESSAGE_ID); - struct smbd_smb2_lock_state *state; - - DEBUG(10,("smbd_smb2_request_lock_done: cancelled mid %llu\n", - (unsigned long long)mid )); - - state = tevent_req_data(smb2req->subreq, - struct smbd_smb2_lock_state); - - SMB_ASSERT(state); - SMB_ASSERT(state->blr); - - remove_pending_lock(state, state->blr); - - error = smbd_smb2_request_error(smb2req, NT_STATUS_CANCELLED); - if (!NT_STATUS_IS_OK(error)) { - smbd_server_connection_terminate(smb2req->sconn, - nt_errstr(error)); - return; - } - return; - } - status = smbd_smb2_lock_recv(subreq); TALLOC_FREE(subreq); if (!NT_STATUS_IS_OK(status)) { @@ -405,9 +380,10 @@ static bool smbd_smb2_lock_cancel(struct tevent_req *req) } smb2req = state->smb2req; - smb2req->cancelled = true; - tevent_req_done(req); + remove_pending_lock(state, state->blr); + tevent_req_defer_callback(req, smb2req->sconn->ev_ctx); + tevent_req_nterror(req, NT_STATUS_CANCELLED); return true; } diff --git a/source3/smbd/smb2_notify.c b/source3/smbd/smb2_notify.c index 886bc89..81aa615 100644 --- a/source3/smbd/smb2_notify.c +++ b/source3/smbd/smb2_notify.c @@ -28,7 +28,6 @@ struct smbd_smb2_notify_state { struct smbd_smb2_request *smb2req; struct smb_request *smbreq; - struct tevent_immediate *im; NTSTATUS status; DATA_BLOB out_output_buffer; }; @@ -113,24 +112,6 @@ static void smbd_smb2_request_notify_done(struct tevent_req *subreq) NTSTATUS status; NTSTATUS error; /* transport error */ - if (req->cancelled) { - struct smbd_smb2_notify_state *state = tevent_req_data(subreq, - struct smbd_smb2_notify_state); - const uint8_t *inhdr = SMBD_SMB2_IN_HDR_PTR(req); - uint64_t mid = BVAL(inhdr, SMB2_HDR_MESSAGE_ID); - - DEBUG(10,("smbd_smb2_request_notify_done: cancelled mid %llu\n", - (unsigned long long)mid )); - error = smbd_smb2_request_error(req, NT_STATUS_CANCELLED); - if (!NT_STATUS_IS_OK(error)) { - smbd_server_connection_terminate(req->sconn, - nt_errstr(error)); - return; - } - TALLOC_FREE(state->im); - return; - } - status = smbd_smb2_notify_recv(subreq, req, &out_output_buffer); @@ -177,9 +158,6 @@ static void smbd_smb2_request_notify_done(struct tevent_req *subreq) static void smbd_smb2_notify_reply(struct smb_request *smbreq, NTSTATUS error_code, uint8_t *buf, size_t len); -static void smbd_smb2_notify_reply_trigger(struct tevent_context *ctx, - struct tevent_immediate *im, - void *private_data); static bool smbd_smb2_notify_cancel(struct tevent_req *req); static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, @@ -205,7 +183,6 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, state->smb2req = smb2req; state->status = NT_STATUS_INTERNAL_ERROR; state->out_output_buffer = data_blob_null; - state->im = NULL; DEBUG(10,("smbd_smb2_notify_send: %s - %s\n", fsp_str_dbg(fsp), fsp_fnum_dbg(fsp))); @@ -275,11 +252,6 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - state->im = tevent_create_immediate(state); - if (tevent_req_nomem(state->im, req)) { - return tevent_req_post(req, ev); - } - /* * No changes pending, queue the request */ @@ -321,30 +293,7 @@ static void smbd_smb2_notify_reply(struct smb_request *smbreq, } } - if (state->im == NULL) { - smbd_smb2_notify_reply_trigger(NULL, NULL, req); - return; - } - - /* - * if this is called async, we need to go via an immediate event - * because the caller replies on the smb_request (a child of req - * being arround after calling this function - */ - tevent_schedule_immediate(state->im, - state->smb2req->sconn->ev_ctx, - smbd_smb2_notify_reply_trigger, - req); -} - -static void smbd_smb2_notify_reply_trigger(struct tevent_context *ctx, - struct tevent_immediate *im, - void *private_data) -{ - struct tevent_req *req = talloc_get_type_abort(private_data, - struct tevent_req); - struct smbd_smb2_notify_state *state = tevent_req_data(req, - struct smbd_smb2_notify_state); + tevent_req_defer_callback(req, state->smb2req->sconn->ev_ctx); if (!NT_STATUS_IS_OK(state->status)) { tevent_req_nterror(req, state->status); @@ -361,8 +310,6 @@ static bool smbd_smb2_notify_cancel(struct tevent_req *req) smbd_notify_cancel_by_smbreq(state->smbreq); - state->smb2req->cancelled = true; - tevent_req_done(req); return true; } diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c index e0c615a..2890f86 100644 --- a/source3/smbd/smb2_read.c +++ b/source3/smbd/smb2_read.c @@ -363,8 +363,6 @@ static bool smbd_smb2_read_cancel(struct tevent_req *req) tevent_req_data(req, struct smbd_smb2_read_state); - state->smb2req->cancelled = true; - return cancel_smb2_aio(state->smbreq); } diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index fd90b2f..dcaefb1 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -713,7 +713,6 @@ static NTSTATUS smbd_smb2_request_validate(struct smbd_smb2_request *req) struct iovec *hdr = SMBD_SMB2_IDX_HDR_IOV(req,in,idx); struct iovec *body = SMBD_SMB2_IDX_BODY_IOV(req,in,idx); const uint8_t *inhdr = NULL; - uint32_t flags; if (hdr->iov_len != SMB2_HDR_BODY) { return NT_STATUS_INVALID_PARAMETER; @@ -733,50 +732,6 @@ static NTSTATUS smbd_smb2_request_validate(struct smbd_smb2_request *req) if (!smb2_validate_message_id(req->sconn, inhdr)) { return NT_STATUS_INVALID_PARAMETER; } - - flags = IVAL(inhdr, SMB2_HDR_FLAGS); - if (idx < SMBD_SMB2_NUM_IOV_PER_REQ) { - /* - * the 1st request should never have the - * SMB2_HDR_FLAG_CHAINED flag set - */ - if (flags & SMB2_HDR_FLAG_CHAINED) { - req->next_status = NT_STATUS_INVALID_PARAMETER; - return NT_STATUS_OK; - } - } else if (idx < 2*SMBD_SMB2_NUM_IOV_PER_REQ) { - /* - * the 2nd request triggers related vs. unrelated - * compounded requests - */ - if (flags & SMB2_HDR_FLAG_CHAINED) { - req->compound_related = true; - } - } else { -#if 0 - /* - * It seems the this tests are wrong - * see the SMB2-COMPOUND test - */ - - /* - * all other requests should match the 2nd one - */ - if (flags & SMB2_HDR_FLAG_CHAINED) { - if (!req->compound_related) { - req->next_status = - NT_STATUS_INVALID_PARAMETER; - return NT_STATUS_OK; - } - } else { - if (req->compound_related) { - req->next_status = - NT_STATUS_INVALID_PARAMETER; - return NT_STATUS_OK; - } - } -#endif - } } return NT_STATUS_OK; @@ -1342,9 +1297,13 @@ NTSTATUS smbd_smb2_request_pending_queue(struct smbd_smb2_request *req, * request chain. This is not allowed. * Cancel the outstanding request. */ - tevent_req_cancel(req->subreq); + bool ok = tevent_req_cancel(req->subreq); + if (ok) { + return NT_STATUS_OK; + } + TALLOC_FREE(req->subreq); return smbd_smb2_request_error(req, - NT_STATUS_INSUFFICIENT_RESOURCES); + NT_STATUS_INTERNAL_ERROR); } if (DEBUGLEVEL >= 10) { @@ -1691,6 +1650,8 @@ static NTSTATUS smbd_smb2_request_check_tcon(struct smbd_smb2_request *req) in_tid = req->last_tid; } + req->last_tid = 0; + status = smb2srv_tcon_lookup(req->session, in_tid, now, &tcon); if (!NT_STATUS_IS_OK(status)) { @@ -1740,6 +1701,8 @@ static NTSTATUS smbd_smb2_request_check_session(struct smbd_smb2_request *req) in_session_id = req->last_session_id; } + req->last_session_id = 0; + /* lookup an existing session */ status = smb2srv_session_lookup(req->sconn->conn, in_session_id, now, @@ -1994,6 +1957,18 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); } + if (flags & SMB2_HDR_FLAG_CHAINED) { + /* + * This check is mostly for giving the correct error code + * for compounded requests. + */ + if (!NT_STATUS_IS_OK(session_status)) { + return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); + } + } else { + req->compat_chain_fsp = NULL; + } + if (req->do_encryption) { signing_required = false; } else if (flags & SMB2_HDR_FLAG_SIGNED) { @@ -2043,21 +2018,7 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) } if (flags & SMB2_HDR_FLAG_CHAINED) { - /* - * This check is mostly for giving the correct error code - * for compounded requests. - * - * TODO: we may need to move this after the session - * and tcon checks. - */ - if (!NT_STATUS_IS_OK(req->next_status)) { - return smbd_smb2_request_error(req, req->next_status); - } - } else { - req->compat_chain_fsp = NULL; - } - - if (req->compound_related) { + req->compound_related = true; req->sconn->smb2.compound_related_in_progress = true; } @@ -2421,6 +2382,7 @@ static NTSTATUS smbd_smb2_request_reply(struct smbd_smb2_request *req) } if (req->compound_related) { + req->compound_related = false; req->sconn->smb2.compound_related_in_progress = false; } @@ -2683,10 +2645,9 @@ NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req, } /* - * if a request fails, all other remaining - * compounded requests should fail too + * Note: Even if there is an error, continue to process the request. + * per MS-SMB2. */ - req->next_status = NT_STATUS_INVALID_PARAMETER; return smbd_smb2_request_done_ex(req, status, body, info, __location__); } diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c index 03998ca..f9cfbfc 100644 --- a/source3/smbd/smb2_write.c +++ b/source3/smbd/smb2_write.c @@ -236,8 +236,6 @@ static bool smbd_smb2_write_cancel(struct tevent_req *req) tevent_req_data(req, struct smbd_smb2_write_state); - state->smb2req->cancelled = true; - return cancel_smb2_aio(state->smbreq); } diff --git a/source4/torture/smb2/compound.c b/source4/torture/smb2/compound.c index 0eef369..e75f682 100644 --- a/source4/torture/smb2/compound.c +++ b/source4/torture/smb2/compound.c @@ -34,9 +34,6 @@ goto done; \ }} while (0) -#define TARGET_IS_W2K8(_tctx) (torture_setting_bool(_tctx, "w2k8", false)) -#define TARGET_IS_WIN7(_tctx) (torture_setting_bool(_tctx, "win7", false)) - static bool test_compound_related1(struct torture_context *tctx, struct smb2_tree *tree) { @@ -190,9 +187,9 @@ static bool test_compound_related2(struct torture_context *tctx, status = smb2_close_recv(req[2], &cl); CHECK_STATUS(status, NT_STATUS_FILE_CLOSED); status = smb2_close_recv(req[3], &cl); - CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); + CHECK_STATUS(status, NT_STATUS_FILE_CLOSED); status = smb2_close_recv(req[4], &cl); - CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); + CHECK_STATUS(status, NT_STATUS_FILE_CLOSED); TALLOC_FREE(tree->smbXcli); tree->smbXcli = saved_tcon; @@ -348,9 +345,9 @@ static bool test_compound_invalid1(struct torture_context *tctx, const char *fname = "compound_invalid1.dat"; struct smb2_close cl; bool ret = true; - struct smb2_request *req[2]; + struct smb2_request *req[3]; - smb2_transport_credits_ask_num(tree->session->transport, 2); + smb2_transport_credits_ask_num(tree->session->transport, 3); smb2_util_unlink(tree, fname); @@ -374,7 +371,7 @@ static bool test_compound_invalid1(struct torture_context *tctx, 0x00200000; cr.in.fname = fname; - smb2_transport_compound_start(tree->session->transport, 2); + smb2_transport_compound_start(tree->session->transport, 3); /* passing the first request with the related flag is invalid */ smb2_transport_compound_set_related(tree->session->transport, true); @@ -388,11 +385,16 @@ static bool test_compound_invalid1(struct torture_context *tctx, cl.in.file.handle = hd; req[1] = smb2_close_send(tree, &cl); + smb2_transport_compound_set_related(tree->session->transport, false); + req[2] = smb2_close_send(tree, &cl); + status = smb2_create_recv(req[0], tree, &cr); /* TODO: check why this fails with --signing=required */ CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); status = smb2_close_recv(req[1], &cl); CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); + status = smb2_close_recv(req[2], &cl); + CHECK_STATUS(status, NT_STATUS_FILE_CLOSED); smb2_util_unlink(tree, fname); -- Samba Shared Repository