From: Ralph Boehme Date: Fri, 7 Mar 2025 11:57:24 +0000 (+0100) Subject: smbd: fix check for POSIX opens in have_file_open_below() X-Git-Tag: tevent-0.17.0~579 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce8a65054d59c0eca7317a6e34b20b138e17393b;p=thirdparty%2Fsamba.git smbd: fix check for POSIX opens in have_file_open_below() Pair-Programmed-With: Stefan Metzmacher Signed-off-by: Ralph Boehme Signed-off-by: Stefan Metzmacher --- diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index afc9c74dfdd..f934ae74019 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -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;