From: Ralph Boehme Date: Fri, 13 Oct 2023 08:54:44 +0000 (+0200) Subject: smbd: fix has_other_nonposix_opens_fn() X-Git-Tag: talloc-2.4.2~776 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=95443320847967ea6412e59b5b7d3853fffe588a;p=thirdparty%2Fsamba.git smbd: fix has_other_nonposix_opens_fn() Given two opens on a file: 1. Windows open with delete-on-close 2. POSIX open with delete-on-close set When handle 1 is closed processing in has_other_nonposix_opens_fn() will not delete the file as (fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) is false, so has_other_nonposix_opens() will return true which is wrong. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15517 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Mon Nov 13 19:34:29 UTC 2023 on atb-devel-224 --- diff --git a/selftest/knownfail.d/samba.tests.smb3unix.samba.tests.smb3unix.Smb3UnixTests b/selftest/knownfail.d/samba.tests.smb3unix.samba.tests.smb3unix.Smb3UnixTests deleted file mode 100644 index e893a357571..00000000000 --- a/selftest/knownfail.d/samba.tests.smb3unix.samba.tests.smb3unix.Smb3UnixTests +++ /dev/null @@ -1 +0,0 @@ -^samba.tests.smb3unix.samba.tests.smb3unix.Smb3UnixTests.test_delete_on_close\(fileserver_smb1\) diff --git a/source3/smbd/close.c b/source3/smbd/close.c index ad451ecd1e6..f1f5e41a43f 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -241,8 +241,7 @@ static bool has_other_nonposix_opens_fn( if (e->name_hash != fsp->name_hash) { return false; } - if ((fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) && - (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) { + if (e->flags & SHARE_MODE_FLAG_POSIX_OPEN) { return false; } if (e->share_file_id == fh_get_gen_id(fsp->fh)) {