From 885e3fc12de55e56e6170be4456101bda09d8a17 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 22 Nov 2022 07:31:52 +0100 Subject: [PATCH] smbd: reject FILE_ATTRIBUTE_TEMPORARY on directories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cf MS-FSA 2.1.5.14.2 BUG: https://bugzilla.samba.org/show_bug.cgi?id=15252 Signed-off-by: Ralph Boehme Reviewed-by: Andrew Bartlett Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Mon Nov 28 10:14:12 UTC 2022 on sn-devel-184 (cherry picked from commit 535a08dfc4c045d7b0c0ed335f76b5d560dd7bbd) Autobuild-User(v4-16-test): Jule Anger Autobuild-Date(v4-16-test): Mon Dec 5 11:03:30 UTC 2022 on sn-devel-184 --- selftest/knownfail.d/samba3.smb2.create.dosattr_tmp_dir | 1 - source3/smbd/dosmode.c | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) delete mode 100644 selftest/knownfail.d/samba3.smb2.create.dosattr_tmp_dir diff --git a/selftest/knownfail.d/samba3.smb2.create.dosattr_tmp_dir b/selftest/knownfail.d/samba3.smb2.create.dosattr_tmp_dir deleted file mode 100644 index ab5e3658836..00000000000 --- a/selftest/knownfail.d/samba3.smb2.create.dosattr_tmp_dir +++ /dev/null @@ -1 +0,0 @@ -^samba3.smb2.create.dosattr_tmp_dir\(.*\) diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index c97cdb65d93..0ae2c959220 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -940,6 +940,13 @@ int file_set_dosmode(connection_struct *conn, return -1; } + if ((S_ISDIR(smb_fname->st.st_ex_mode)) && + (dosmode & FILE_ATTRIBUTE_TEMPORARY)) + { + errno = EINVAL; + return -1; + } + dosmode &= SAMBA_ATTRIBUTES_MASK; DEBUG(10,("file_set_dosmode: setting dos mode 0x%x on file %s\n",