summaryrefslogtreecommitdiff
path: root/source3/smbd/smb2_flush.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/smb2_flush.c')
-rw-r--r--source3/smbd/smb2_flush.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/source3/smbd/smb2_flush.c b/source3/smbd/smb2_flush.c
index fecce45fb4e..a0c3f71a8b5 100644
--- a/source3/smbd/smb2_flush.c
+++ b/source3/smbd/smb2_flush.c
@@ -27,7 +27,7 @@
static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smbd_smb2_request *smb2req,
- uint64_t in_file_id_volatile);
+ struct files_struct *fsp);
static NTSTATUS smbd_smb2_flush_recv(struct tevent_req *req);
static void smbd_smb2_request_flush_done(struct tevent_req *subreq);
@@ -38,6 +38,7 @@ NTSTATUS smbd_smb2_request_process_flush(struct smbd_smb2_request *req)
int i = req->current_idx;
uint64_t in_file_id_persistent;
uint64_t in_file_id_volatile;
+ struct files_struct *in_fsp;
struct tevent_req *subreq;
status = smbd_smb2_request_verify_sizes(req, 0x18);
@@ -49,16 +50,13 @@ NTSTATUS smbd_smb2_request_process_flush(struct smbd_smb2_request *req)
in_file_id_persistent = BVAL(inbody, 0x08);
in_file_id_volatile = BVAL(inbody, 0x10);
- if (req->compat_chain_fsp) {
- /* skip check */
- } else if (in_file_id_persistent != in_file_id_volatile) {
+ in_fsp = file_fsp_smb2(req, in_file_id_persistent, in_file_id_volatile);
+ if (in_fsp == NULL) {
return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}
- subreq = smbd_smb2_flush_send(req,
- req->sconn->ev_ctx,
- req,
- in_file_id_volatile);
+ subreq = smbd_smb2_flush_send(req, req->sconn->ev_ctx,
+ req, in_fsp);
if (subreq == NULL) {
return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
}
@@ -116,13 +114,12 @@ struct smbd_smb2_flush_state {
static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smbd_smb2_request *smb2req,
- uint64_t in_file_id_volatile)
+ struct files_struct *fsp)
{
struct tevent_req *req;
struct smbd_smb2_flush_state *state;
NTSTATUS status;
struct smb_request *smbreq;
- files_struct *fsp;
req = tevent_req_create(mem_ctx, &state,
struct smbd_smb2_flush_state);
@@ -131,8 +128,8 @@ static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx,
}
state->smb2req = smb2req;
- DEBUG(10,("smbd_smb2_flush: file_id[0x%016llX]\n",
- (unsigned long long)in_file_id_volatile));
+ DEBUG(10,("smbd_smb2_flush: %s - fnum[%d]\n",
+ fsp_str_dbg(fsp), fsp->fnum));
smbreq = smbd_smb2_fake_smb_request(smb2req);
if (tevent_req_nomem(smbreq, req)) {
@@ -144,20 +141,6 @@ static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx,
return tevent_req_post(req, ev);
}
- fsp = file_fsp(smbreq, (uint16_t)in_file_id_volatile);
- if (fsp == NULL) {
- tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
- return tevent_req_post(req, ev);
- }
- if (smbreq->conn != fsp->conn) {
- tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
- return tevent_req_post(req, ev);
- }
- if (smb2req->session->vuid != fsp->vuid) {
- tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
- return tevent_req_post(req, ev);
- }
-
if (!CHECK_WRITE(fsp)) {
tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
return tevent_req_post(req, ev);