From: Jeremy Allison Date: Tue, 22 Jun 2021 19:01:13 +0000 (-0700) Subject: s3: VFS: streams_depot: file_is_valid(), SMB_VFS_GETXATTR() -> SMB_VFS_FGETXATTR(). X-Git-Tag: tevent-0.11.0~190 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c308ffa41c2020d3287bd19f743a2cd43e035d9e;p=thirdparty%2Fsamba.git s3: VFS: streams_depot: file_is_valid(), SMB_VFS_GETXATTR() -> SMB_VFS_FGETXATTR(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index fdaa1c476ef..d9abf1d71b9 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -71,14 +71,36 @@ static bool file_is_valid(vfs_handle_struct *handle, const struct smb_filename *smb_fname) { char buf; + NTSTATUS status; + struct smb_filename *pathref = NULL; + int ret; DEBUG(10, ("file_is_valid (%s) called\n", smb_fname->base_name)); - if (SMB_VFS_GETXATTR(handle->conn, smb_fname, SAMBA_XATTR_MARKER, - &buf, sizeof(buf)) != sizeof(buf)) { - DEBUG(10, ("GETXATTR failed: %s\n", strerror(errno))); + status = synthetic_pathref(talloc_tos(), + handle->conn->cwd_fsp, + smb_fname->base_name, + NULL, + NULL, + smb_fname->twrp, + smb_fname->flags, + &pathref); + if (!NT_STATUS_IS_OK(status)) { return false; } + ret = SMB_VFS_FGETXATTR(pathref->fsp, + SAMBA_XATTR_MARKER, + &buf, + sizeof(buf)); + if (ret != sizeof(buf)) { + int saved_errno = errno; + DBG_DEBUG("FGETXATTR failed: %s\n", strerror(saved_errno)); + TALLOC_FREE(pathref); + errno = saved_errno; + return false; + } + + TALLOC_FREE(pathref); if (buf != '1') { DEBUG(10, ("got wrong buffer content: '%c'\n", buf));