From 0bf3b8a09ca7a35cd42ea19d7d0bf8f2645c5b80 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 8 Jun 2012 11:05:58 +0200 Subject: s3:smb2_notify: make use of file_fsp_smb2() metze --- source3/smbd/smb2_notify.c | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'source3') diff --git a/source3/smbd/smb2_notify.c b/source3/smbd/smb2_notify.c index c0315b2948..6a5df016a4 100644 --- a/source3/smbd/smb2_notify.c +++ b/source3/smbd/smb2_notify.c @@ -36,9 +36,9 @@ struct smbd_smb2_notify_state { static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct smbd_smb2_request *smb2req, + struct files_struct *in_fsp, uint16_t in_flags, uint32_t in_output_buffer_length, - uint64_t in_file_id_volatile, uint64_t in_completion_filter); static NTSTATUS smbd_smb2_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, @@ -54,6 +54,7 @@ NTSTATUS smbd_smb2_request_process_notify(struct smbd_smb2_request *req) uint32_t in_output_buffer_length; uint64_t in_file_id_persistent; uint64_t in_file_id_volatile; + struct files_struct *in_fsp; uint64_t in_completion_filter; struct tevent_req *subreq; @@ -84,18 +85,15 @@ NTSTATUS smbd_smb2_request_process_notify(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_notify_send(req, - req->sconn->ev_ctx, - req, + subreq = smbd_smb2_notify_send(req, req->sconn->ev_ctx, + req, in_fsp, in_flags, in_output_buffer_length, - in_file_id_volatile, in_completion_filter); if (subreq == NULL) { return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY); @@ -189,16 +187,15 @@ static bool smbd_smb2_notify_cancel(struct tevent_req *req); static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct smbd_smb2_request *smb2req, + struct files_struct *fsp, uint16_t in_flags, uint32_t in_output_buffer_length, - uint64_t in_file_id_volatile, uint64_t in_completion_filter) { struct tevent_req *req; struct smbd_smb2_notify_state *state; struct smb_request *smbreq; connection_struct *conn = smb2req->tcon->compat_conn; - files_struct *fsp; bool recursive = (in_flags & SMB2_WATCH_TREE) ? true : false; NTSTATUS status; @@ -212,8 +209,8 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, state->out_output_buffer = data_blob_null; state->im = NULL; - DEBUG(10,("smbd_smb2_notify_send: file_id[0x%016llX]\n", - (unsigned long long)in_file_id_volatile)); + DEBUG(10,("smbd_smb2_notify_send: %s - fnum[%d]\n", + fsp_str_dbg(fsp), fsp->fnum)); smbreq = smbd_smb2_fake_smb_request(smb2req); if (tevent_req_nomem(smbreq, req)) { @@ -223,20 +220,6 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, state->smbreq = smbreq; smbreq->async_priv = (void *)req; - 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); - } - { char *filter_string; -- cgit