summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-06-08 10:42:43 +0200
committerKarolin Seeger <kseeger@samba.org>2012-06-22 21:51:13 +0200
commitce994bdc186cb488d18ffa505ebd142942ebf026 (patch)
treea3f13f33336fa69e278ee57063bdfb2e70a7e151
parent6a1e1cd18a2e545f05f6d18d2eea4711d6872e71 (diff)
downloadsamba-ce994bdc186cb488d18ffa505ebd142942ebf026.tar.gz
s3:smb2_find: make use of file_fsp_smb2()
metze Signed-off-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 45d61598c626c7e7099361e6a02e2aa3eade5d08)
-rw-r--r--source3/smbd/smb2_find.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c
index 3dcc76862b0..59e5b66e7d2 100644
--- a/source3/smbd/smb2_find.c
+++ b/source3/smbd/smb2_find.c
@@ -28,10 +28,10 @@
static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smbd_smb2_request *smb2req,
+ struct files_struct *in_fsp,
uint8_t in_file_info_class,
uint8_t in_flags,
uint32_t in_file_index,
- uint64_t in_file_id_volatile,
uint32_t in_output_buffer_length,
const char *in_file_name);
static NTSTATUS smbd_smb2_find_recv(struct tevent_req *req,
@@ -49,6 +49,7 @@ NTSTATUS smbd_smb2_request_process_find(struct smbd_smb2_request *req)
uint32_t in_file_index;
uint64_t in_file_id_persistent;
uint64_t in_file_id_volatile;
+ struct files_struct *in_fsp;
uint16_t in_file_name_offset;
uint16_t in_file_name_length;
DATA_BLOB in_file_name_buffer;
@@ -115,19 +116,16 @@ NTSTATUS smbd_smb2_request_process_find(struct smbd_smb2_request *req)
return smbd_smb2_request_error(req, NT_STATUS_OBJECT_NAME_INVALID);
}
- 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_find_send(req,
- req->sconn->smb2.event_ctx,
- req,
+ subreq = smbd_smb2_find_send(req, req->sconn->smb2.event_ctx,
+ req, in_fsp,
in_file_info_class,
in_flags,
in_file_index,
- in_file_id_volatile,
in_output_buffer_length,
in_file_name_string);
if (subreq == NULL) {
@@ -207,10 +205,10 @@ struct smbd_smb2_find_state {
static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smbd_smb2_request *smb2req,
+ struct files_struct *fsp,
uint8_t in_file_info_class,
uint8_t in_flags,
uint32_t in_file_index,
- uint64_t in_file_id_volatile,
uint32_t in_output_buffer_length,
const char *in_file_name)
{
@@ -218,7 +216,6 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
struct smbd_smb2_find_state *state;
struct smb_request *smbreq;
connection_struct *conn = smb2req->tcon->compat_conn;
- files_struct *fsp;
NTSTATUS status;
NTSTATUS empty_status;
uint32_t info_level;
@@ -241,28 +238,14 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
state->smb2req = smb2req;
state->out_output_buffer = data_blob_null;
- DEBUG(10,("smbd_smb2_find_send: file_id[0x%016llX]\n",
- (unsigned long long)in_file_id_volatile));
+ DEBUG(10,("smbd_smb2_find_send: %s - fnum[%d]\n",
+ fsp_str_dbg(fsp), fsp->fnum));
smbreq = smbd_smb2_fake_smb_request(smb2req);
if (tevent_req_nomem(smbreq, req)) {
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 (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_NOT_SUPPORTED);
return tevent_req_post(req, ev);