From: Volker Lendecke Date: Thu, 31 Mar 2022 16:12:32 +0000 (+0200) Subject: vfs: Simplify streams_depot_openat() X-Git-Tag: tevent-0.12.0~178 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edc4c910f27ea4920734dc2a62e4f57862024ed7;p=thirdparty%2Fsamba.git vfs: Simplify streams_depot_openat() We don't need an explicit stat(), VALID_STAT on the existing base_fsp is sufficient. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Apr 1 21:18:37 UTC 2022 on sn-devel-184 --- diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index 23a8fe63b93..cc2d25a36f6 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -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; }