The Samba-Bugzilla – Attachment 16624 Details for
Bug 14714
SMB2 Close returns unexpected timestamps
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.13 and 4.14 cherry-picked from master
bug14714-v413,v414.patch (text/plain), 5.80 KB, created by
Ralph Böhme
on 2021-05-25 07:43:41 UTC
(
hide
)
Description:
Patch for 4.13 and 4.14 cherry-picked from master
Filename:
MIME Type:
Creator:
Ralph Böhme
Created:
2021-05-25 07:43:41 UTC
Size:
5.80 KB
patch
obsolete
>From d0c165461dafcd650e804242da50000368a7748e Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Mon, 24 May 2021 12:21:38 +0200 >Subject: [PATCH 1/2] torture: add a test that verifies SMB2 close fields > without postqueryattrib > >The server must set all fields to 0 if postqueryattrib is not set. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14714 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit ac9042ff4dc6c892764abd23a9445116ad40e62a) >--- > selftest/knownfail.d/samba3.smb2.timestamps | 1 + > source4/torture/smb2/timestamps.c | 65 +++++++++++++++++++++ > 2 files changed, 66 insertions(+) > create mode 100644 selftest/knownfail.d/samba3.smb2.timestamps > >diff --git a/selftest/knownfail.d/samba3.smb2.timestamps b/selftest/knownfail.d/samba3.smb2.timestamps >new file mode 100644 >index 00000000000..04bdab81cf3 >--- /dev/null >+++ b/selftest/knownfail.d/samba3.smb2.timestamps >@@ -0,0 +1 @@ >+^samba3.smb2.timestamps.test_close_not_attrib.* >diff --git a/source4/torture/smb2/timestamps.c b/source4/torture/smb2/timestamps.c >index f0cc9c269ff..c37e81d2adc 100644 >--- a/source4/torture/smb2/timestamps.c >+++ b/source4/torture/smb2/timestamps.c >@@ -29,6 +29,70 @@ > #define BASEDIR "smb2-timestamps" > #define FNAME "testfile.dat" > >+static bool test_close_no_attrib(struct torture_context *tctx, >+ struct smb2_tree *tree) >+{ >+ const char *filename = BASEDIR "/" FNAME; >+ struct smb2_create cr; >+ struct smb2_handle handle = {{0}}; >+ struct smb2_handle testdirh = {{0}}; >+ struct smb2_close c; >+ NTSTATUS status; >+ bool ret = true; >+ >+ smb2_deltree(tree, BASEDIR); >+ >+ status = torture_smb2_testdir(tree, BASEDIR, &testdirh); >+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done, >+ "torture_smb2_testdir failed\n"); >+ smb2_util_close(tree, testdirh); >+ >+ cr = (struct smb2_create) { >+ .in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED, >+ .in.file_attributes = FILE_ATTRIBUTE_NORMAL, >+ .in.share_access = NTCREATEX_SHARE_ACCESS_MASK, >+ .in.create_disposition = NTCREATEX_DISP_OPEN_IF, >+ .in.impersonation_level = NTCREATEX_IMPERSONATION_ANONYMOUS, >+ .in.fname = filename, >+ }; >+ >+ status = smb2_create(tree, tctx, &cr); >+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done, >+ "smb2_create failed\n"); >+ handle = cr.out.file.handle; >+ >+ c = (struct smb2_close) { >+ .in.file.handle = handle, >+ }; >+ >+ status = smb2_close(tree, &c); >+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done, >+ "close failed\n"); >+ ZERO_STRUCT(handle); >+ >+ torture_assert_u64_equal_goto(tctx, c.out.create_time, NTTIME_OMIT, >+ ret, done, "Unexpected create time\n"); >+ torture_assert_u64_equal_goto(tctx, c.out.access_time, NTTIME_OMIT, >+ ret, done, "Unexpected access time\n"); >+ torture_assert_u64_equal_goto(tctx, c.out.write_time, NTTIME_OMIT, >+ ret, done, "Unexpected write time\n"); >+ torture_assert_u64_equal_goto(tctx, c.out.change_time, NTTIME_OMIT, >+ ret, done, "Unexpected change time\n"); >+ torture_assert_u64_equal_goto(tctx, c.out.alloc_size, 0, >+ ret, done, "Unexpected allocation size\n"); >+ torture_assert_u64_equal_goto(tctx, c.out.size, 0, >+ ret, done, "Unexpected size\n"); >+ torture_assert_u64_equal_goto(tctx, c.out.file_attr, 0, >+ ret, done, "Unexpected attributes\n"); >+ >+done: >+ if (!smb2_util_handle_empty(handle)) { >+ smb2_util_close(tree, handle); >+ } >+ smb2_deltree(tree, BASEDIR); >+ return ret; >+} >+ > static bool test_time_t(struct torture_context *tctx, > struct smb2_tree *tree, > const char *fname, >@@ -907,6 +971,7 @@ struct torture_suite *torture_smb2_timestamps_init(TALLOC_CTX *ctx) > { > struct torture_suite *suite = torture_suite_create(ctx, "timestamps"); > >+ torture_suite_add_1smb2_test(suite, "test_close_not_attrib", test_close_no_attrib); > torture_suite_add_1smb2_test(suite, "time_t_15032385535", test_time_t_15032385535); > torture_suite_add_1smb2_test(suite, "time_t_10000000000", test_time_t_10000000000); > torture_suite_add_1smb2_test(suite, "time_t_4294967295", test_time_t_4294967295); >-- >2.30.2 > > >From 9637ee379cb632b04800d8393331161c2e66b2ab Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Mon, 24 May 2021 12:03:28 +0200 >Subject: [PATCH 2/2] smbd: correctly initialize close timestamp fields > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14714 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> > >Autobuild-User(master): Jeremy Allison <jra@samba.org> >Autobuild-Date(master): Mon May 24 16:56:22 UTC 2021 on sn-devel-184 > >(cherry picked from commit f96cc29711181b5237a5b92c4bfb5e75fe2a73b9) >--- > selftest/knownfail.d/samba3.smb2.timestamps | 1 - > source3/smbd/smb2_close.c | 8 ++++---- > 2 files changed, 4 insertions(+), 5 deletions(-) > delete mode 100644 selftest/knownfail.d/samba3.smb2.timestamps > >diff --git a/selftest/knownfail.d/samba3.smb2.timestamps b/selftest/knownfail.d/samba3.smb2.timestamps >deleted file mode 100644 >index 04bdab81cf3..00000000000 >--- a/selftest/knownfail.d/samba3.smb2.timestamps >+++ /dev/null >@@ -1 +0,0 @@ >-^samba3.smb2.timestamps.test_close_not_attrib.* >diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c >index 229b41cd91c..03c60156370 100644 >--- a/source3/smbd/smb2_close.c >+++ b/source3/smbd/smb2_close.c >@@ -225,10 +225,10 @@ static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req, > uint16_t flags = 0; > bool posix_open = false; > >- ZERO_STRUCTP(out_creation_ts); >- ZERO_STRUCTP(out_last_access_ts); >- ZERO_STRUCTP(out_last_write_ts); >- ZERO_STRUCTP(out_change_ts); >+ *out_creation_ts = (struct timespec){0, SAMBA_UTIME_OMIT}; >+ *out_last_access_ts = (struct timespec){0, SAMBA_UTIME_OMIT}; >+ *out_last_write_ts = (struct timespec){0, SAMBA_UTIME_OMIT}; >+ *out_change_ts = (struct timespec){0, SAMBA_UTIME_OMIT}; > > *out_flags = 0; > *out_allocation_size = 0; >-- >2.30.2 >
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:
jra
:
review+
Actions:
View
Attachments on
bug 14714
: 16624