From: Jeremy Allison Date: Mon, 8 Nov 2021 22:09:53 +0000 (-0800) Subject: s3: smbd: In open_file(), use a helper variable instead of always checking sp->posix_... X-Git-Tag: ldb-2.5.0~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51b582546b5d613a108f8b5a3ef4b7a1cd99df86;p=thirdparty%2Fsamba.git s3: smbd: In open_file(), use a helper variable instead of always checking sp->posix_flags & FSP_POSIX_FLAGS_OPEN. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index df24f8d1b0e..79a0650ec4d 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1283,6 +1283,7 @@ static NTSTATUS open_file(files_struct *fsp, bool creating = !file_existed && (flags & O_CREAT); bool truncating = (flags & O_TRUNC); bool open_fd = false; + bool posix_open = (fsp->posix_flags & FSP_POSIX_FLAGS_OPEN); /* * Catch early an attempt to open an existing @@ -1531,7 +1532,7 @@ static NTSTATUS open_file(files_struct *fsp, } if (S_ISLNK(smb_fname->st.st_ex_mode) && - !(fsp->posix_flags & FSP_POSIX_FLAGS_OPEN)) + !posix_open) { /* * Don't allow stat opens on symlinks directly unless @@ -1573,7 +1574,7 @@ static NTSTATUS open_file(files_struct *fsp, access_mask); if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND) && - (fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) && + posix_open && S_ISLNK(smb_fname->st.st_ex_mode)) { /* This is a POSIX stat open for delete * or rename on a symlink that points