s3: VFS: streams_depot: file_is_valid(), SMB_VFS_GETXATTR() -> SMB_VFS_FGETXATTR().
authorJeremy Allison <jra@samba.org>
Tue, 22 Jun 2021 19:01:13 +0000 (12:01 -0700)
committerRalph Boehme <slow@samba.org>
Fri, 25 Jun 2021 15:53:31 +0000 (15:53 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_streams_depot.c

index fdaa1c476ef8afa9b36b847c26c80ad511a255a0..d9abf1d71b9f4eedd4c42c6ac5d70b64c546ab8a 100644 (file)
@@ -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));