From: Ralph Boehme Date: Tue, 22 Nov 2022 06:31:52 +0000 (+0100) Subject: smbd: reject FILE_ATTRIBUTE_TEMPORARY on directories X-Git-Tag: talloc-2.4.0~476 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=535a08dfc4c045d7b0c0ed335f76b5d560dd7bbd;p=thirdparty%2Fsamba.git smbd: reject FILE_ATTRIBUTE_TEMPORARY on directories 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 --- 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 40fe7b5166a..2e3aa0934a7 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -918,6 +918,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",