summaryrefslogtreecommitdiffstats
path: root/source3/smbd/smb2_find.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-06-08 10:42:43 +0200
committerStefan Metzmacher <metze@samba.org>2012-06-09 21:23:44 +0200
commit4dfadfc61d2f860847dcbde100127d7b6cd9d06d (patch)
tree0babaeebe5c5981c793e50d92d1801e3898b9a00 /source3/smbd/smb2_find.c
parent3909ad4690b75ebcfa8c9060435961d7a71e28a6 (diff)
downloadsamba-4dfadfc61d2f860847dcbde100127d7b6cd9d06d.tar.gz
samba-4dfadfc61d2f860847dcbde100127d7b6cd9d06d.tar.xz
samba-4dfadfc61d2f860847dcbde100127d7b6cd9d06d.zip
s3:smb2_find: make use of file_fsp_smb2()
metze
Diffstat (limited to 'source3/smbd/smb2_find.c')
-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 eb221183f6a..187a5ffa655 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->ev_ctx,
- req,
+ subreq = smbd_smb2_find_send(req, req->sconn->ev_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) {
@@ -203,10 +201,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)
{
@@ -214,7 +212,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;
@@ -237,28 +234,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);