]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs: Simplify streams_depot_openat()
authorVolker Lendecke <vl@samba.org>
Thu, 31 Mar 2022 16:12:32 +0000 (18:12 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 1 Apr 2022 21:18:37 +0000 (21:18 +0000)
We don't need an explicit stat(), VALID_STAT on the existing base_fsp
is sufficient.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Apr  1 21:18:37 UTC 2022 on sn-devel-184

source3/modules/vfs_streams_depot.c

index 23a8fe63b93a5eae4b3572e15669317f52a71e20..cc2d25a36f609983aeecd8cb913b8abde0ae0aea 100644 (file)
@@ -710,7 +710,6 @@ static int streams_depot_openat(struct vfs_handle_struct *handle,
                                mode_t mode)
 {
        struct smb_filename *smb_fname_stream = NULL;
-       struct smb_filename *smb_fname_base = NULL;
        struct files_struct *fspcwd = NULL;
        NTSTATUS status;
        int ret = -1;
@@ -725,29 +724,7 @@ static int streams_depot_openat(struct vfs_handle_struct *handle,
        }
 
        SMB_ASSERT(fsp_is_alternate_stream(fsp));
-
-       /*
-        * For now assert this so the below SMB_VFS_STAT() is ok.
-        */
-       SMB_ASSERT(fsp_get_pathref_fd(dirfsp) == AT_FDCWD);
-
-       /* Ensure the base file still exists. */
-       smb_fname_base = synthetic_smb_fname(talloc_tos(),
-                                       smb_fname->base_name,
-                                       NULL,
-                                       NULL,
-                                       smb_fname->twrp,
-                                       smb_fname->flags);
-       if (smb_fname_base == NULL) {
-               ret = -1;
-               errno = ENOMEM;
-               goto done;
-       }
-
-       ret = SMB_VFS_NEXT_STAT(handle, smb_fname_base);
-       if (ret == -1) {
-               goto done;
-       }
+       SMB_ASSERT(VALID_STAT(fsp->base_fsp->fsp_name->st));
 
        /* Determine the stream name, and then open it. */
        status = stream_smb_fname(handle, smb_fname, &smb_fname_stream, true);
@@ -773,7 +750,6 @@ static int streams_depot_openat(struct vfs_handle_struct *handle,
 
  done:
        TALLOC_FREE(smb_fname_stream);
-       TALLOC_FREE(smb_fname_base);
        TALLOC_FREE(fspcwd);
        return ret;
 }