smbd: canonicalize SMB_VFS_FSTAT() stat buffer
authorRalph Boehme <slow@samba.org>
Tue, 6 Jul 2021 07:04:26 +0000 (09:04 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 14 Jul 2021 08:09:31 +0000 (08:09 +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>
source3/smbd/open.c

index 49f02fb5be9841da10950e539bb3bbc9395dfe6c..c29662b4fd25bfcb02fd90603c3b994d483e36d0 100644 (file)
@@ -779,12 +779,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) &&