smbd: canonicalize SMB_VFS_FSTAT() stat buffer
authorRalph Boehme <slow@samba.org>
Tue, 6 Jul 2021 07:04:26 +0000 (09:04 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 17 Aug 2021 09:08:36 +0000 (09:08 +0000)
This helps code inside any module implementing fstat() looking at
fsp->fsp_name->st instead of the passed in stat buf.

I only ran afoul of this in a DEBUG message I added while debugging some inode
related problem.

No change in behaviour.

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

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

source3/smbd/open.c

index b9f5472b765ff6d3c3cc0d296970e2bf993b518e..2a370fc71b144dd4b62b89f2174572eccebfbf88 100644 (file)
@@ -796,12 +796,12 @@ static NTSTATUS non_widelink_open(const struct files_struct *dirfsp,
        fsp_set_fd(fsp, fd);
 
        if (fd != -1) {
-               ret = SMB_VFS_FSTAT(fsp, &orig_fsp_name->st);
+               ret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st);
                if (ret != 0) {
                        status = map_nt_error_from_unix(errno);
                        goto out;
                }
-               fsp->fsp_name->st = orig_fsp_name->st;
+               orig_fsp_name->st = fsp->fsp_name->st;
        }
 
        if (!is_ntfs_stream_smb_fname(fsp->fsp_name) &&