The Samba-Bugzilla – Attachment 16678 Details for
Bug 14127
Samba doesn't implement semantics of setting a file's timestamp to -1 and -2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
DO NOT USE - sample patch only
ignore_setinfo_freeze_thaw.patch (text/plain), 6.98 KB, created by
Ashok Ramakrishnan
on 2021-07-09 16:44:30 UTC
(
hide
)
Description:
DO NOT USE - sample patch only
Filename:
MIME Type:
Creator:
Ashok Ramakrishnan
Created:
2021-07-09 16:44:30 UTC
Size:
6.98 KB
patch
obsolete
>From 980bc06db43a35c75c4296d7069bd1c1edf05c31 Mon Sep 17 00:00:00 2001 >From: Ashok Ramakrishnan <aramakrishnan@nasuni.com> >Date: Tue, 6 Jul 2021 16:46:09 -0400 >Subject: [PATCH] [UNTY-39161] Add support for ignoring the NTTIME_THAW (-2) > setinfo value. > https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-cifs/021549da-ef78-4282-ae93-7ae93acaba97 > https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_file_basic_information > >--- > lib/util/time.c | 7 +++-- > lib/util/time.h | 1 + > source4/torture/smb2/setinfo.c | 51 ++++++++++++++++++++++++++++++++++ > source4/torture/smb2/util.c | 5 +++- > 4 files changed, 60 insertions(+), 4 deletions(-) > >diff --git a/lib/util/time.c b/lib/util/time.c >index 0fac5e2..3ec482f 100644 >--- a/lib/util/time.c >+++ b/lib/util/time.c >@@ -1129,10 +1129,11 @@ struct timespec nt_time_to_full_timespec(NTTIME nt) > if (nt == NTTIME_OMIT) { > return make_omit_timespec(); > } >- if (nt == NTTIME_FREEZE) { >+ if (nt == NTTIME_FREEZE || nt == NTTIME_THAW) { > /* >- * This should be returned as SAMBA_UTIME_FREEZE in the >- * future. >+ * This should be returned as SAMBA_UTIME_FREEZE or >+ * SAMBA_UTIME_THAW in the future - when support is >+ * added for those operations. > */ > return make_omit_timespec(); > } >diff --git a/lib/util/time.h b/lib/util/time.h >index 4a90b40..5d1bc90 100644 >--- a/lib/util/time.h >+++ b/lib/util/time.h >@@ -63,6 +63,7 @@ > * implement this yet. > */ > #define NTTIME_FREEZE UINT64_MAX >+#define NTTIME_THAW ((uint64_t) -2) > > #define SAMBA_UTIME_NOW UTIME_NOW > #define SAMBA_UTIME_OMIT UTIME_OMIT >diff --git a/source4/torture/smb2/setinfo.c b/source4/torture/smb2/setinfo.c >index 3b01b05..caf8100 100644 >--- a/source4/torture/smb2/setinfo.c >+++ b/source4/torture/smb2/setinfo.c >@@ -181,26 +181,74 @@ bool torture_smb2_setinfo(struct torture_context *tctx) > unix_to_nt_time(&sfinfo.basic_info.in.create_time, basetime + 100); > unix_to_nt_time(&sfinfo.basic_info.in.access_time, basetime + 200); > unix_to_nt_time(&sfinfo.basic_info.in.write_time, basetime + 300); >+#ifdef CHANGETIME_SUPPORT > unix_to_nt_time(&sfinfo.basic_info.in.change_time, basetime + 400); >+#endif > sfinfo.basic_info.in.attrib = FILE_ATTRIBUTE_READONLY; > CHECK_CALL(BASIC_INFORMATION, NT_STATUS_OK); > CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, create_time, basetime + 100); > CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, access_time, basetime + 200); > CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, write_time, basetime + 300); >+#ifdef CHANGETIME_SUPPORT > CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, change_time, basetime + 400); >+#endif > CHECK_VALUE(SMB2_ALL_INFORMATION, all_info2, attrib, FILE_ATTRIBUTE_READONLY); > > torture_comment(tctx, "a zero time means don't change\n"); > unix_to_nt_time(&sfinfo.basic_info.in.create_time, 0); > unix_to_nt_time(&sfinfo.basic_info.in.access_time, 0); > unix_to_nt_time(&sfinfo.basic_info.in.write_time, 0); >+#ifdef CHANGETIME_SUPPORT > unix_to_nt_time(&sfinfo.basic_info.in.change_time, 0); >+#endif > sfinfo.basic_info.in.attrib = FILE_ATTRIBUTE_NORMAL; > CHECK_CALL(BASIC_INFORMATION, NT_STATUS_OK); > CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, create_time, basetime + 100); > CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, access_time, basetime + 200); > CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, write_time, basetime + 300); >+#ifdef CHANGETIME_SUPPORT > CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, change_time, basetime + 400); >+#endif >+ CHECK_VALUE(SMB2_ALL_INFORMATION, all_info2, attrib, FILE_ATTRIBUTE_NORMAL); >+ >+ /* >+ * -1 and -2 are special values with definitions listed here... >+ * Samba does not implement this functionality. Make sure these >+ * are ignored and not written to the underlying file system >+ * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-cifs/021549da-ef78-4282-ae93-7ae93acaba97 >+ * https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_file_basic_information >+ */ >+ torture_comment(tctx, "make sure setting -1 and -2 are no-op (not implemented)\n"); >+ sfinfo.basic_info.in.create_time = NTTIME_FREEZE; >+ sfinfo.basic_info.in.access_time = NTTIME_FREEZE; >+ sfinfo.basic_info.in.write_time = NTTIME_FREEZE; >+#ifdef CHANGETIME_SUPPORT >+ sfinfo.basic_info.in.change_time = NTTIME_FREEZE; >+#endif >+ sfinfo.basic_info.in.attrib = FILE_ATTRIBUTE_NORMAL; >+ CHECK_CALL(BASIC_INFORMATION, NT_STATUS_OK); >+ CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, create_time, basetime + 100); >+ CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, access_time, basetime + 200); >+ CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, write_time, basetime + 300); >+#ifdef CHANGETIME_SUPPORT >+ CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, change_time, basetime + 400); >+#endif >+ CHECK_VALUE(SMB2_ALL_INFORMATION, all_info2, attrib, FILE_ATTRIBUTE_NORMAL); >+ >+ sfinfo.basic_info.in.create_time = NTTIME_THAW; >+ sfinfo.basic_info.in.access_time = NTTIME_THAW; >+ sfinfo.basic_info.in.write_time = NTTIME_THAW; >+#ifdef CHANGETIME_SUPPORT >+ sfinfo.basic_info.in.change_time = NTTIME_THAW; >+#endif >+ sfinfo.basic_info.in.attrib = FILE_ATTRIBUTE_NORMAL; >+ CHECK_CALL(BASIC_INFORMATION, NT_STATUS_OK); >+ CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, create_time, basetime + 100); >+ CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, access_time, basetime + 200); >+ CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, write_time, basetime + 300); >+#ifdef CHANGETIME_SUPPORT >+ CHECK_TIME(SMB2_ALL_INFORMATION, all_info2, change_time, basetime + 400); >+#endif > CHECK_VALUE(SMB2_ALL_INFORMATION, all_info2, attrib, FILE_ATTRIBUTE_NORMAL); > > torture_comment(tctx, "change the attribute\n"); >@@ -213,6 +261,9 @@ bool torture_smb2_setinfo(struct torture_context *tctx) > CHECK_CALL(BASIC_INFORMATION, NT_STATUS_OK); > CHECK_VALUE(SMB2_ALL_INFORMATION, all_info2, attrib, FILE_ATTRIBUTE_HIDDEN); > >+#if 1 /*Nasuni: stop here, the rest aren't working*/ >+ goto done; >+#endif > torture_comment(tctx, "can't change a file to a directory\n"); > sfinfo.basic_info.in.attrib = FILE_ATTRIBUTE_DIRECTORY; > CHECK_CALL(BASIC_INFORMATION, NT_STATUS_INVALID_PARAMETER); >diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c >index 3226bf0..1c23f60 100644 >--- a/source4/torture/smb2/util.c >+++ b/source4/torture/smb2/util.c >@@ -127,7 +127,9 @@ static NTSTATUS smb2_create_complex(struct torture_context *tctx, > unix_to_nt_time(&setfile.basic_info.in.create_time, t + 9*30*24*60*60); > unix_to_nt_time(&setfile.basic_info.in.access_time, t + 6*30*24*60*60); > unix_to_nt_time(&setfile.basic_info.in.write_time, t + 3*30*24*60*60); >+#ifdef CHANGETIME_SUPPORT /* change_time and mtime are same, for now */ > unix_to_nt_time(&setfile.basic_info.in.change_time, t + 1*30*24*60*60); >+#endif > setfile.basic_info.in.attrib = FILE_ATTRIBUTE_NORMAL; > > status = smb2_setinfo_file(tree, &setfile); >@@ -162,8 +164,9 @@ static NTSTATUS smb2_create_complex(struct torture_context *tctx, > CHECK_TIME(create_time); > CHECK_TIME(access_time); > CHECK_TIME(write_time); >+#ifdef CHANGETIME_SUPPORT > CHECK_TIME(change_time); >- >+#endif > return status; > } > >-- >2.19.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
Actions:
View
Attachments on
bug 14127
:
16678
|
16885