s3: smbd: smbd_smb2_getinfo_send(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name...
authorJeremy Allison <jra@samba.org>
Fri, 18 Mar 2022 18:45:50 +0000 (11:45 -0700)
committerJule Anger <janger@samba.org>
Mon, 11 Apr 2022 08:32:10 +0000 (08:32 +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 7fb2038faca256c03c2bd7d982f39f5b1a57f784)

source3/smbd/smb2_getinfo.c

index 6df4a37af179b3ba2ac14e26fd5ba4fe42a52dee..9ff97c4d80d261eec9da16b824de1513bffa3afc 100644 (file)
@@ -374,11 +374,11 @@ static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx,
                         * Original code - this is an open file.
                         */
 
-                       if (SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) != 0) {
+                       status = vfs_stat_fsp(fsp);
+                       if (!NT_STATUS_IS_OK(status)) {
                                DEBUG(3, ("smbd_smb2_getinfo_send: "
                                          "fstat of %s failed (%s)\n",
-                                         fsp_fnum_dbg(fsp), strerror(errno)));
-                               status = map_nt_error_from_unix(errno);
+                                         fsp_fnum_dbg(fsp), nt_errstr(status)));
                                tevent_req_nterror(req, status);
                                return tevent_req_post(req, ev);
                        }