From 0d21c676ae55c5d3303f4ab32611130546fa27f6 Mon Sep 17 00:00:00 2001 From: David Mulder Date: Thu, 17 Mar 2022 10:51:59 -0600 Subject: [PATCH] smbd: Move check_fsp_open to smb2_reply.c Signed-off-by: David Mulder Reviewed-by: Jeremy Allison --- source3/smbd/proto.h | 4 ++-- source3/smbd/reply.c | 18 ------------------ source3/smbd/smb2_reply.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 18b73856917..3e6d3368e5c 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -912,8 +912,6 @@ bool disk_quotas(connection_struct *conn, struct smb_filename *fname, /* The following definitions come from smbd/reply.c */ -bool check_fsp_open(connection_struct *conn, struct smb_request *req, - files_struct *fsp); bool check_fsp(connection_struct *conn, struct smb_request *req, files_struct *fsp); bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req, @@ -1036,6 +1034,8 @@ size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req, NTSTATUS *err); size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req, char **dest, const uint8_t *src, int flags); +bool check_fsp_open(connection_struct *conn, struct smb_request *req, + files_struct *fsp); /* The following definitions come from smbd/seal.c */ diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 77816e1883a..d9ac7766454 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -53,24 +53,6 @@ #include "source3/printing/rap_jobid.h" #include "source3/lib/substitute.h" -/**************************************************************************** - Check if we have a correct fsp pointing to a file. Basic check for open fsp. -****************************************************************************/ - -bool check_fsp_open(connection_struct *conn, struct smb_request *req, - files_struct *fsp) -{ - if ((fsp == NULL) || (conn == NULL)) { - reply_nterror(req, NT_STATUS_INVALID_HANDLE); - return False; - } - if ((conn != fsp->conn) || (req->vuid != fsp->vuid)) { - reply_nterror(req, NT_STATUS_INVALID_HANDLE); - return False; - } - return True; -} - /**************************************************************************** Check if we have a correct fsp pointing to a file. ****************************************************************************/ diff --git a/source3/smbd/smb2_reply.c b/source3/smbd/smb2_reply.c index 7fa1fb1d265..a84af62f895 100644 --- a/source3/smbd/smb2_reply.c +++ b/source3/smbd/smb2_reply.c @@ -390,3 +390,21 @@ size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req, return pull_string_talloc(ctx, req->inbuf, req->flags2, dest, src, bufrem, flags); } + +/**************************************************************************** + Check if we have a correct fsp pointing to a file. Basic check for open fsp. +****************************************************************************/ + +bool check_fsp_open(connection_struct *conn, struct smb_request *req, + files_struct *fsp) +{ + if ((fsp == NULL) || (conn == NULL)) { + reply_nterror(req, NT_STATUS_INVALID_HANDLE); + return False; + } + if ((conn != fsp->conn) || (req->vuid != fsp->vuid)) { + reply_nterror(req, NT_STATUS_INVALID_HANDLE); + return False; + } + return True; +}