s3: cmd_vfs: cmd_set_nt_acl(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st...
authorJeremy Allison <jra@samba.org>
Fri, 18 Mar 2022 22:04:34 +0000 (15:04 -0700)
committerJule Anger <janger@samba.org>
Mon, 11 Apr 2022 07:49:13 +0000 (07:49 +0000)
If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
we must call vfs_stat_fsp() as this preserves the iflags.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 23d5c909286d438534f1a7defb2faacd1877fea1)

source3/torture/cmd_vfs.c

index 1499bd0046f89a701a03d16e5234599bf2235279..b8d8b8d3acd58d86b244c453d43534ac44a6231c 100644 (file)
@@ -1702,7 +1702,6 @@ static NTSTATUS cmd_fset_nt_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
 static NTSTATUS cmd_set_nt_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
 {
        int flags;
-       int ret;
        mode_t mode;
        files_struct *fsp;
        struct files_struct *fspcwd = NULL;
@@ -1773,18 +1772,13 @@ static NTSTATUS cmd_set_nt_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int a
        }
        fsp_set_fd(fsp, fd);
 
-       status = NT_STATUS_OK;
-       ret = SMB_VFS_FSTAT(fsp, &smb_fname->st);
-       if (ret == -1) {
+       status = vfs_stat_fsp(fsp);
+       if (!NT_STATUS_IS_OK(status)) {
                /* If we have an fd, this stat should succeed. */
                DEBUG(0,("Error doing fstat on open file %s "
                         "(%s)\n",
                         smb_fname_str_dbg(smb_fname),
-                        strerror(errno) ));
-               status = map_nt_error_from_unix(errno);
-       }
-       
-       if (!NT_STATUS_IS_OK(status)) {
+                        nt_errstr(status) ));
                goto out;
        }