]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: fix check for POSIX opens in have_file_open_below()
authorRalph Boehme <slow@samba.org>
Fri, 7 Mar 2025 11:57:24 +0000 (12:57 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 7 Mar 2025 19:00:32 +0000 (19:00 +0000)
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/dir.c

index afc9c74dfddbd928b35b1a8d00a59249ca6e1035..f934ae740190b9779fe2f3a29c7e51271aa3becf 100644 (file)
@@ -1293,6 +1293,7 @@ void RewindDir(struct smb_Dir *dir_hnd)
 }
 
 struct have_file_open_below_state {
+       bool dirfsp_is_posix;
        bool found_one;
 };
 
@@ -1307,7 +1308,9 @@ static int have_file_open_below_fn(const struct share_mode_data *data,
                return 0;
        }
 
-       if (e->flags & SHARE_MODE_FLAG_POSIX_OPEN) {
+       if (state->dirfsp_is_posix &&
+           e->flags & SHARE_MODE_FLAG_POSIX_OPEN)
+       {
                /* Ignore POSIX opens */
                return 0;
        }
@@ -1324,7 +1327,7 @@ static int have_file_open_below_fn(const struct share_mode_data *data,
 bool have_file_open_below(struct files_struct *fsp)
 {
        struct have_file_open_below_state state = {
-               .found_one = false,
+               .dirfsp_is_posix = fsp->fsp_flags.posix_open,
        };
        int ret;