smbd: move check_fsp to smb2_reply.c
authorDavid Mulder <dmulder@suse.com>
Thu, 17 Mar 2022 16:53:35 +0000 (10:53 -0600)
committerJeremy Allison <jra@samba.org>
Thu, 7 Apr 2022 17:37:29 +0000 (17:37 +0000)
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/proto.h
source3/smbd/reply.c
source3/smbd/smb2_reply.c

index 3e6d3368e5c1447ced247aa044bd668b00e35a79..3f3f0e54e71e993ea3e5a50ebfaeb75065695a85 100644 (file)
@@ -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(connection_struct *conn, struct smb_request *req,
-              files_struct *fsp);
 bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
                              files_struct *fsp);
 void reply_special(struct smbXsrv_connection *xconn, char *inbuf, size_t inbuf_size);
@@ -1036,6 +1034,8 @@ 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);
+bool check_fsp(connection_struct *conn, struct smb_request *req,
+              files_struct *fsp);
 
 /* The following definitions come from smbd/seal.c  */
 
index d9ac7766454de7ab9eeba76ea6ea3c930cd3a8af..5147c602b95e107f077dff9af4d2dfb2772c7668 100644 (file)
 #include "source3/printing/rap_jobid.h"
 #include "source3/lib/substitute.h"
 
-/****************************************************************************
- Check if we have a correct fsp pointing to a file.
-****************************************************************************/
-
-bool check_fsp(connection_struct *conn, struct smb_request *req,
-              files_struct *fsp)
-{
-       if (!check_fsp_open(conn, req, fsp)) {
-               return False;
-       }
-       if (fsp->fsp_flags.is_directory) {
-               reply_nterror(req, NT_STATUS_INVALID_DEVICE_REQUEST);
-               return False;
-       }
-       if (fsp_get_pathref_fd(fsp) == -1) {
-               reply_nterror(req, NT_STATUS_ACCESS_DENIED);
-               return False;
-       }
-       fsp->num_smb_operations++;
-       return True;
-}
-
 /****************************************************************************
  Check if we have a correct fsp pointing to a quota fake file. Replacement for
  the CHECK_NTQUOTA_HANDLE_OK macro.
index a84af62f8958a19898ee23e047b324c6c1f24cb9..f42aa0e48c077c4f828d0ffc9d436a2ddfe39476 100644 (file)
@@ -408,3 +408,25 @@ bool check_fsp_open(connection_struct *conn, struct smb_request *req,
        }
        return True;
 }
+
+/****************************************************************************
+ Check if we have a correct fsp pointing to a file.
+****************************************************************************/
+
+bool check_fsp(connection_struct *conn, struct smb_request *req,
+              files_struct *fsp)
+{
+       if (!check_fsp_open(conn, req, fsp)) {
+               return False;
+       }
+       if (fsp->fsp_flags.is_directory) {
+               reply_nterror(req, NT_STATUS_INVALID_DEVICE_REQUEST);
+               return False;
+       }
+       if (fsp_get_pathref_fd(fsp) == -1) {
+               reply_nterror(req, NT_STATUS_ACCESS_DENIED);
+               return False;
+       }
+       fsp->num_smb_operations++;
+       return True;
+}