From: Jeremy Allison Date: Fri, 18 Mar 2022 19:19:44 +0000 (-0700) Subject: s3: smbd: mkdir_internal(). 1 of 2. All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name... X-Git-Tag: tevent-0.12.0~269 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=064c5770deb4307272c60f0b08f6bc137df4b227;p=thirdparty%2Fsamba.git s3: smbd: mkdir_internal(). 1 of 2. All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags. 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 Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 8f6bb8eb120..a0ade5dd87b 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -4352,10 +4352,11 @@ static NTSTATUS mkdir_internal(connection_struct *conn, /* Ensure we're checking for a symlink here.... */ /* We don't want to get caught by a symlink racer. */ - if (SMB_VFS_FSTAT(fsp, &smb_dname->st) == -1) { + status = vfs_stat_fsp(fsp); + if (!NT_STATUS_IS_OK(status)) { DEBUG(2, ("Could not stat directory '%s' just created: %s\n", - smb_fname_str_dbg(smb_dname), strerror(errno))); - return map_nt_error_from_unix(errno); + smb_fname_str_dbg(smb_dname), nt_errstr(status))); + return status; } if (!S_ISDIR(smb_dname->st.st_ex_mode)) {