diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-06-08 10:14:45 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-06-09 21:23:44 +0200 |
commit | 9e1e656c603e2a80c3261b6a87e285c19821757b (patch) | |
tree | dce29b95c7593d3f31f5306740c759e98ced1720 /source3/smbd | |
parent | 2a804a359af5bb171afc0d04bb91e48601b8c067 (diff) | |
download | samba-9e1e656c603e2a80c3261b6a87e285c19821757b.tar.gz samba-9e1e656c603e2a80c3261b6a87e285c19821757b.tar.bz2 samba-9e1e656c603e2a80c3261b6a87e285c19821757b.zip |
s3:smb2_flush: make use of file_fsp_smb2()
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/smb2_flush.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/source3/smbd/smb2_flush.c b/source3/smbd/smb2_flush.c index fecce45fb4..a0c3f71a8b 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); |