]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: In open_file(), use a helper variable instead of always checking sp->posix_...
authorJeremy Allison <jra@samba.org>
Mon, 8 Nov 2021 22:09:53 +0000 (14:09 -0800)
committerRalph Boehme <slow@samba.org>
Tue, 16 Nov 2021 20:21:37 +0000 (20:21 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/open.c

index df24f8d1b0e086b097da4ba2e5acdb17e368f878..79a0650ec4d1b9c51bb8c562f3660784c8649168 100644 (file)
@@ -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