]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: remove parent_dirname_compatible_open()
authorRalph Boehme <slow@samba.org>
Thu, 22 May 2025 15:52:28 +0000 (17:52 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 28 May 2025 15:06:29 +0000 (15:06 +0000)
This is now handled correctly smbd_smb2_setinfo_rename_dst_parent_check().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15861

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Bjoern Jacke <bjacke@samba.org>
selftest/knownfail
source3/smbd/smb2_reply.c

index 3b02dcef2de6cc4e5a520fa215326dec2009e707..103a0bb1d76a53bfb0899e960d0e99d0f611e560 100644 (file)
 ^samba3.smb2.dir.one
 ^samba3.smb2.dir.modify
 ^samba3.smb2.oplock.stream1
-^samba3.smb2.streams.rename
 ^samba3.smb2.streams.rename2
-^samba3.smb2.streams streams_xattr.rename\(nt4_dc\)
 ^samba3.smb2.streams streams_xattr.rename2\(nt4_dc\)
 ^samba3.smb2.getinfo.complex
 ^samba3.smb2.getinfo.fsinfo # quotas don't work yet
index 00c9f2aa6e68bbdea9f9f775bf01f886599f9f2e..cc8f02ea12404556747ba98c3d1ed3b9b32a03bb 100644 (file)
@@ -1343,49 +1343,6 @@ static void notify_rename(struct connection_struct *conn,
        TALLOC_FREE(parent_dir_dst);
 }
 
-/****************************************************************************
- Returns an error if the parent directory for a filename is open in an
- incompatible way.
-****************************************************************************/
-
-static NTSTATUS parent_dirname_compatible_open(connection_struct *conn,
-                                       const struct smb_filename *smb_fname_dst_in)
-{
-       struct smb_filename *smb_fname_parent = NULL;
-       struct file_id id;
-       files_struct *fsp = NULL;
-       int ret;
-       NTSTATUS status;
-
-       status = SMB_VFS_PARENT_PATHNAME(conn,
-                                        talloc_tos(),
-                                        smb_fname_dst_in,
-                                        &smb_fname_parent,
-                                        NULL);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
-       ret = vfs_stat(conn, smb_fname_parent);
-       if (ret == -1) {
-               return map_nt_error_from_unix(errno);
-       }
-
-       /*
-        * We're only checking on this smbd here, mostly good
-        * enough.. and will pass tests.
-        */
-
-       id = vfs_file_id_from_sbuf(conn, &smb_fname_parent->st);
-       for (fsp = file_find_di_first(conn->sconn, id, true); fsp;
-                       fsp = file_find_di_next(fsp, true)) {
-               if (fsp->access_mask & DELETE_ACCESS) {
-                       return NT_STATUS_SHARING_VIOLATION;
-                }
-        }
-       return NT_STATUS_OK;
-}
-
 /****************************************************************************
  Rename an open file - given an fsp.
 ****************************************************************************/
@@ -1414,11 +1371,6 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
                                true : conn->case_preserve;
        struct vfs_rename_how rhow = { .flags = 0, };
 
-       status = parent_dirname_compatible_open(conn, smb_fname_dst_in);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
        if (file_has_open_streams(fsp)) {
                return NT_STATUS_ACCESS_DENIED;
        }