]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Remove vfs_file_exist()
authorVolker Lendecke <vl@samba.org>
Fri, 24 Jan 2025 11:58:22 +0000 (12:58 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 5 Feb 2025 00:07:30 +0000 (00:07 +0000)
Both callers followed this with SMB_VFS_CREATE_FILE which can be given
FILE_NON_DIRECTORY_FILE as an option to achieve the same.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/printing/nt_printing.c
source3/smbd/proto.h
source3/smbd/smb2_reply.c
source3/smbd/vfs.c

index 14a1e496c04a8aded23cd637d8e91bb55b1e3fbc..5b322c38baf227f98998f44c7b07a3af6ec96b53 100644 (file)
@@ -1090,13 +1090,6 @@ static uint32_t get_correct_cversion(const struct auth_session_info *session_inf
                goto error_exit;
        }
 
-       nt_status = vfs_file_exist(conn, smb_fname);
-       if (!NT_STATUS_IS_OK(nt_status)) {
-               DEBUG(3,("get_correct_cversion: vfs_file_exist failed\n"));
-               *perr = WERR_FILE_NOT_FOUND;
-               goto error_exit;
-       }
-
        nt_status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                NULL,                                   /* req */
@@ -1105,7 +1098,7 @@ static uint32_t get_correct_cversion(const struct auth_session_info *session_inf
                FILE_GENERIC_READ,                      /* access_mask */
                FILE_SHARE_READ | FILE_SHARE_WRITE,     /* share_access */
                FILE_OPEN,                              /* create_disposition*/
-               0,                                      /* create_options */
+               FILE_NON_DIRECTORY_FILE,                /* create_options */
                FILE_ATTRIBUTE_NORMAL,                  /* file_attributes */
                INTERNAL_OPEN_ONLY,                     /* oplock_request */
                NULL,                                   /* lease */
index 33bfd5b7ae40575fbecd286c056bf21a09b6a675..f53b6a7bbfb3492034ec6fa1d529025617819cb6 100644 (file)
@@ -1165,7 +1165,6 @@ void sys_utmp_yield(const char *username, const char *hostname,
 
 bool vfs_init_custom(connection_struct *conn, const char *vfs_object);
 bool smbd_vfs_init(connection_struct *conn);
-NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname);
 bool vfs_valid_pread_range(off_t offset, size_t length);
 bool vfs_valid_pwrite_range(const struct files_struct *fsp,
                            off_t offset,
index 693fad9bce67d9eb5b0dfdc9631d07c78cc67cfd..794b5ddf66b9ee7ad15b7af097597e9326e23b7b 100644 (file)
@@ -2004,11 +2004,6 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
-       status = vfs_file_exist(conn, smb_fname_src);
-       if (!NT_STATUS_IS_OK(status)) {
-               goto out;
-       }
-
        status = openat_pathref_fsp(conn->cwd_fsp, smb_fname_src);
        if (!NT_STATUS_IS_OK(status)) {
                goto out;
@@ -2023,7 +2018,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
                FILE_GENERIC_READ,                      /* access_mask */
                FILE_SHARE_READ | FILE_SHARE_WRITE,     /* share_access */
                FILE_OPEN,                              /* create_disposition*/
-               0,                                      /* create_options */
+               FILE_NON_DIRECTORY_FILE,                /* create_options */
                FILE_ATTRIBUTE_NORMAL,                  /* file_attributes */
                INTERNAL_OPEN_ONLY,                     /* oplock_request */
                NULL,                                   /* lease */
index a1d4e7707dbe5f5c7405008bacb198383c2195a1..76895f52e03995c88b77948818b872d48ce0a001 100644 (file)
@@ -403,21 +403,6 @@ bool smbd_vfs_init(connection_struct *conn)
        return True;
 }
 
-/*******************************************************************
- Check if a file exists in the vfs.
-********************************************************************/
-
-NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname)
-{
-       /* Only return OK if stat was successful and S_ISREG */
-       if ((SMB_VFS_STAT(conn, smb_fname) != -1) &&
-           S_ISREG(smb_fname->st.st_ex_mode)) {
-               return NT_STATUS_OK;
-       }
-
-       return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-}
-
 bool vfs_valid_pread_range(off_t offset, size_t length)
 {
        return sys_valid_io_range(offset, length);