The Samba-Bugzilla – Attachment 17669 Details for
Bug 15252
smbd allows setting FILE_ATTRIBUTE_TEMPORARY on directories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.16 cherry-picked from master
bug15252-416.patch (text/plain), 5.31 KB, created by
Ralph Böhme
on 2022-11-28 14:51:36 UTC
(
hide
)
Description:
Patch for 4.16 cherry-picked from master
Filename:
MIME Type:
Creator:
Ralph Böhme
Created:
2022-11-28 14:51:36 UTC
Size:
5.31 KB
patch
obsolete
>From 5e98054e2da910e169c356a39733fe23b66640dd Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Tue, 22 Nov 2022 10:45:35 +0100 >Subject: [PATCH 1/2] torture: add a test trying to set > FILE_ATTRIBUTE_TEMPORARY on a directory > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15252 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit fdb19ce8aa189f6cfbd2d1fd7ed6fe809ba93cf3) >--- > selftest/knownfail | 1 + > .../samba3.smb2.create.dosattr_tmp_dir | 1 + > source4/torture/smb2/create.c | 47 +++++++++++++++++++ > 3 files changed, 49 insertions(+) > create mode 100644 selftest/knownfail.d/samba3.smb2.create.dosattr_tmp_dir > >diff --git a/selftest/knownfail b/selftest/knownfail >index a630270e5f08..7851ec397a0b 100644 >--- a/selftest/knownfail >+++ b/selftest/knownfail >@@ -146,6 +146,7 @@ > ^samba4.smb2.create.*.acldir > ^samba4.smb2.create.*.impersonation > ^samba4.smb2.create.quota-fake-file\(ad_dc_ntvfs\) # not supported by the NTVFS >+^samba4.smb2.create.dosattr_tmp_dir\(ad_dc_ntvfs\) > ^samba4.smb2.acls.*.generic > ^samba4.smb2.acls.*.inheritflags > ^samba4.smb2.acls.*.owner >diff --git a/selftest/knownfail.d/samba3.smb2.create.dosattr_tmp_dir b/selftest/knownfail.d/samba3.smb2.create.dosattr_tmp_dir >new file mode 100644 >index 000000000000..ab5e36588369 >--- /dev/null >+++ b/selftest/knownfail.d/samba3.smb2.create.dosattr_tmp_dir >@@ -0,0 +1 @@ >+^samba3.smb2.create.dosattr_tmp_dir\(.*\) >diff --git a/source4/torture/smb2/create.c b/source4/torture/smb2/create.c >index 94dbae917fd2..956224b5b08a 100644 >--- a/source4/torture/smb2/create.c >+++ b/source4/torture/smb2/create.c >@@ -3059,6 +3059,52 @@ static bool test_fileid_unique_dir( > return test_fileid_unique_object(tctx, tree, 100, true); > } > >+static bool test_dosattr_tmp_dir(struct torture_context *tctx, >+ struct smb2_tree *tree) >+{ >+ bool ret = true; >+ NTSTATUS status; >+ struct smb2_create c; >+ struct smb2_handle h1 = {{0}}; >+ const char *fname = DNAME; >+ >+ smb2_deltree(tree, fname); >+ smb2_util_rmdir(tree, fname); >+ >+ c = (struct smb2_create) { >+ .in.desired_access = SEC_RIGHTS_DIR_ALL, >+ .in.file_attributes = FILE_ATTRIBUTE_DIRECTORY, >+ .in.create_disposition = NTCREATEX_DISP_OPEN_IF, >+ .in.share_access = NTCREATEX_SHARE_ACCESS_READ | >+ NTCREATEX_SHARE_ACCESS_WRITE | >+ NTCREATEX_SHARE_ACCESS_DELETE, >+ .in.create_options = NTCREATEX_OPTIONS_DIRECTORY, >+ .in.fname = DNAME, >+ }; >+ >+ status = smb2_create(tree, tctx, &c); >+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done, >+ "smb2_create\n"); >+ h1 = c.out.file.handle; >+ >+ /* Try to set temporary attribute on directory */ >+ SET_ATTRIB(FILE_ATTRIBUTE_TEMPORARY); >+ >+ torture_assert_ntstatus_equal_goto(tctx, status, >+ NT_STATUS_INVALID_PARAMETER, >+ ret, done, >+ "Unexpected setinfo result\n"); >+ >+done: >+ if (!smb2_util_handle_empty(h1)) { >+ smb2_util_close(tree, h1); >+ } >+ smb2_util_unlink(tree, fname); >+ smb2_deltree(tree, fname); >+ >+ return ret; >+} >+ > /* > test opening quota fakefile handle and returned attributes > */ >@@ -3141,6 +3187,7 @@ struct torture_suite *torture_smb2_create_init(TALLOC_CTX *ctx) > torture_suite_add_1smb2_test(suite, "nulldacl", test_create_null_dacl); > torture_suite_add_1smb2_test(suite, "mkdir-dup", test_mkdir_dup); > torture_suite_add_1smb2_test(suite, "dir-alloc-size", test_dir_alloc_size); >+ torture_suite_add_1smb2_test(suite, "dosattr_tmp_dir", test_dosattr_tmp_dir); > torture_suite_add_1smb2_test(suite, "quota-fake-file", test_smb2_open_quota_fake_file); > > suite->description = talloc_strdup(suite, "SMB2-CREATE tests"); >-- >2.38.1 > > >From 4c63682acbd487b40eb366999c4e87a04d457bbe Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Tue, 22 Nov 2022 07:31:52 +0100 >Subject: [PATCH 2/2] 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 <slow@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> > >Autobuild-User(master): Ralph Böhme <slow@samba.org> >Autobuild-Date(master): Mon Nov 28 10:14:12 UTC 2022 on sn-devel-184 > >(cherry picked from commit 535a08dfc4c045d7b0c0ed335f76b5d560dd7bbd) >--- > 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 ab5e36588369..000000000000 >--- 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 c97cdb65d938..0ae2c959220d 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", >-- >2.38.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
slow
:
review?
(
metze
)
vl
:
review+
Actions:
View
Attachments on
bug 15252
: 17669 |
17670