From: Noel Power Date: Thu, 18 Feb 2021 21:13:07 +0000 (+0000) Subject: s3/modules: stream_dir make sure mark_file_valid is called with fsp X-Git-Tag: tevent-0.11.0~1579 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1fd550f2b4c081bc59455ec15fab9c3cfce9879f;p=thirdparty%2Fsamba.git s3/modules: stream_dir make sure mark_file_valid is called with fsp can we get this further up the call path ??? Signed-off-by: Noel Power Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index bfaab2bf9d4..410b6c9e0db 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -96,7 +96,7 @@ static bool mark_file_valid(vfs_handle_struct *handle, DEBUG(10, ("marking file %s as valid\n", smb_fname->base_name)); - ret = SMB_VFS_SETXATTR(handle->conn, smb_fname, SAMBA_XATTR_MARKER, + ret = SMB_VFS_FSETXATTR(smb_fname->fsp, SAMBA_XATTR_MARKER, &buf, sizeof(buf), 0); if (ret == -1) { @@ -130,6 +130,8 @@ static char *stream_dir(vfs_handle_struct *handle, char *rootdir = NULL; struct smb_filename *rootdir_fname = NULL; struct smb_filename *tmp_fname = NULL; + struct smb_filename *tmpref = NULL; + const struct smb_filename *pathref = NULL; int ret; check_valid = lp_parm_bool(SNUM(handle->conn), @@ -378,11 +380,27 @@ static char *stream_dir(vfs_handle_struct *handle, if ((ret != 0) && (errno != EEXIST)) { goto fail; } - - if (check_valid && !mark_file_valid(handle, smb_fname)) { + pathref = smb_fname; + if (smb_fname->fsp == NULL) { + NTSTATUS status; + status = synthetic_pathref(talloc_tos(), + handle->conn->cwd_fsp, + smb_fname->base_name, + NULL, + NULL, + smb_fname->twrp, + smb_fname->flags, + &tmpref); + if (!NT_STATUS_IS_OK(status)) { + goto fail; + } + pathref = tmpref; + } + if (check_valid && !mark_file_valid(handle, pathref)) { goto fail; } + TALLOC_FREE(tmpref); TALLOC_FREE(rootdir_fname); TALLOC_FREE(rootdir); TALLOC_FREE(tmp_fname); @@ -390,6 +408,7 @@ static char *stream_dir(vfs_handle_struct *handle, return result; fail: + TALLOC_FREE(tmpref); TALLOC_FREE(rootdir_fname); TALLOC_FREE(rootdir); TALLOC_FREE(tmp_fname);