summaryrefslogtreecommitdiff
path: root/source3/smbd/smb2_write.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-06-08 11:47:05 +0200
committerStefan Metzmacher <metze@samba.org>2012-06-09 21:23:45 +0200
commit951c5a6455f726bdc13bc00300b38bfc32f28c81 (patch)
tree388d8ab6668dc84d869ab5d71015e4843ad88c8c /source3/smbd/smb2_write.c
parent564e618e9f4b8947f070fa41b06e6f04257529aa (diff)
downloadsamba-951c5a6455f726bdc13bc00300b38bfc32f28c81.tar.gz
s3:smb2_write: make use of file_fsp_smb2()
metze
Diffstat (limited to 'source3/smbd/smb2_write.c')
-rw-r--r--source3/smbd/smb2_write.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c
index a149cb84dd3..0aa7303328a 100644
--- a/source3/smbd/smb2_write.c
+++ b/source3/smbd/smb2_write.c
@@ -28,8 +28,8 @@
static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smbd_smb2_request *smb2req,
+ struct files_struct *in_fsp,
uint32_t in_smbpid,
- uint64_t in_file_id_volatile,
DATA_BLOB in_data,
uint64_t in_offset,
uint32_t in_flags);
@@ -50,6 +50,7 @@ NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req)
uint64_t in_offset;
uint64_t in_file_id_persistent;
uint64_t in_file_id_volatile;
+ struct files_struct *in_fsp;
uint32_t in_flags;
struct tevent_req *subreq;
@@ -93,17 +94,14 @@ NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req)
return smbd_smb2_request_error(req, status);
}
- 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_write_send(req,
- req->sconn->ev_ctx,
- req,
+ subreq = smbd_smb2_write_send(req, req->sconn->ev_ctx,
+ req, in_fsp,
in_smbpid,
- in_file_id_volatile,
in_data_buffer,
in_offset,
in_flags);
@@ -238,8 +236,8 @@ static bool smbd_smb2_write_cancel(struct tevent_req *req)
static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smbd_smb2_request *smb2req,
+ struct files_struct *fsp,
uint32_t in_smbpid,
- uint64_t in_file_id_volatile,
DATA_BLOB in_data,
uint64_t in_offset,
uint32_t in_flags)
@@ -249,7 +247,6 @@ static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx,
struct smbd_smb2_write_state *state = NULL;
struct smb_request *smbreq = NULL;
connection_struct *conn = smb2req->tcon->compat_conn;
- files_struct *fsp = NULL;
ssize_t nwritten;
struct lock_struct lock;
@@ -265,8 +262,8 @@ static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx,
state->in_length = in_data.length;
state->out_count = 0;
- DEBUG(10,("smbd_smb2_write: file_id[0x%016llX]\n",
- (unsigned long long)in_file_id_volatile));
+ DEBUG(10,("smbd_smb2_write: %s - fnum[%d]\n",
+ fsp_str_dbg(fsp), fsp->fnum));
smbreq = smbd_smb2_fake_smb_request(smb2req);
if (tevent_req_nomem(smbreq, req)) {
@@ -274,20 +271,6 @@ static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx,
}
state->smbreq = smbreq;
- 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 (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);
- }
-
state->fsp = fsp;
if (IS_IPC(smbreq->conn)) {