summaryrefslogtreecommitdiffstats
path: root/source3/smbd
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-06-08 11:24:02 +0200
committerStefan Metzmacher <metze@samba.org>2012-06-09 21:23:45 +0200
commit564e618e9f4b8947f070fa41b06e6f04257529aa (patch)
treed53c4aeca099e89e0daf13fc7523b2fb168a98c0 /source3/smbd
parent0bf3b8a09ca7a35cd42ea19d7d0bf8f2645c5b80 (diff)
downloadsamba-564e618e9f4b8947f070fa41b06e6f04257529aa.tar.gz
samba-564e618e9f4b8947f070fa41b06e6f04257529aa.tar.xz
samba-564e618e9f4b8947f070fa41b06e6f04257529aa.zip
s3:smb2_read: make use of file_fsp_smb2()
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/smb2_read.c40
1 files changed, 11 insertions, 29 deletions
diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c
index abaf4c66c2..7bf712bc45 100644
--- a/source3/smbd/smb2_read.c
+++ b/source3/smbd/smb2_read.c
@@ -30,8 +30,8 @@
static struct tevent_req *smbd_smb2_read_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,
uint32_t in_length,
uint64_t in_offset,
uint32_t in_minimum,
@@ -53,6 +53,7 @@ NTSTATUS smbd_smb2_request_process_read(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_minimum_count;
uint32_t in_remaining_bytes;
struct tevent_req *subreq;
@@ -86,17 +87,14 @@ NTSTATUS smbd_smb2_request_process_read(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_read_send(req,
- req->sconn->ev_ctx,
- req,
+ subreq = smbd_smb2_read_send(req, req->sconn->ev_ctx,
+ req, in_fsp,
in_smbpid,
- in_file_id_volatile,
in_length,
in_offset,
in_minimum_count,
@@ -173,7 +171,6 @@ struct smbd_smb2_read_state {
struct smbd_smb2_request *smb2req;
struct smb_request *smbreq;
files_struct *fsp;
- uint64_t in_file_id_volatile;
uint32_t in_length;
uint64_t in_offset;
uint32_t in_minimum;
@@ -381,8 +378,8 @@ static bool smbd_smb2_read_cancel(struct tevent_req *req)
static struct tevent_req *smbd_smb2_read_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,
uint32_t in_length,
uint64_t in_offset,
uint32_t in_minimum,
@@ -393,7 +390,6 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx,
struct smbd_smb2_read_state *state = NULL;
struct smb_request *smbreq = NULL;
connection_struct *conn = smb2req->tcon->compat_conn;
- files_struct *fsp = NULL;
ssize_t nread = -1;
struct lock_struct lock;
int saved_errno;
@@ -410,8 +406,8 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx,
state->out_data = data_blob_null;
state->out_remaining = 0;
- DEBUG(10,("smbd_smb2_read: file_id[0x%016llX]\n",
- (unsigned long long)in_file_id_volatile));
+ DEBUG(10,("smbd_smb2_read: %s - fnum[%d]\n",
+ fsp_str_dbg(fsp), fsp->fnum));
smbreq = smbd_smb2_fake_smb_request(smb2req);
if (tevent_req_nomem(smbreq, req)) {
@@ -419,26 +415,12 @@ static struct tevent_req *smbd_smb2_read_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);
- }
if (fsp->is_directory) {
tevent_req_nterror(req, NT_STATUS_INVALID_DEVICE_REQUEST);
return tevent_req_post(req, ev);
}
state->fsp = fsp;
- state->in_file_id_volatile = in_file_id_volatile;
if (IS_IPC(smbreq->conn)) {
struct tevent_req *subreq = NULL;
@@ -537,10 +519,10 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx,
SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
- DEBUG(10,("smbd_smb2_read: file %s handle [0x%016llX] offset=%llu "
+ DEBUG(10,("smbd_smb2_read: file %s fnum[%d] offset=%llu "
"len=%llu returned %lld\n",
fsp_str_dbg(fsp),
- (unsigned long long)in_file_id_volatile,
+ fsp->fnum,
(unsigned long long)in_offset,
(unsigned long long)in_length,
(long long)nread));