From 52a421111218d94d2e5cb131648bcdf5411d910b Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Mon, 7 Jun 2021 19:02:56 +0200 Subject: [PATCH] smbd: return correct timestamps for quota fake file Prior to 572d4e3a56eef00e29f93482daa21647af7310d0 it was sufficient to initialize struct timespec to zero to return NTTIME 0 (ie not set) over SMB. This fixes the same problem from bug 14714 where the timestamps in an SMB2 CLOSE response. Windows of course does return *some* timestamps, but as it's neither documented nor was I able to figure out where they would be coming from, as well as the Windows client apparently doesn't care, I didn't bother with implementing some sophisticated heuristic to return some timestamps. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14731 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Jun 9 20:38:02 UTC 2021 on sn-devel-184 --- selftest/knownfail.d/samba3.smb2.create | 2 -- source3/smbd/filename.c | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) delete mode 100644 selftest/knownfail.d/samba3.smb2.create diff --git a/selftest/knownfail.d/samba3.smb2.create b/selftest/knownfail.d/samba3.smb2.create deleted file mode 100644 index e1ca027872c..00000000000 --- a/selftest/knownfail.d/samba3.smb2.create +++ /dev/null @@ -1,2 +0,0 @@ -^samba3.smb2.create.quota-fake-file\(nt4_dc\) -^samba3.smb2.create.quota-fake-file\(ad_dc\) diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 44a58a20c1f..11022dca703 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -1972,6 +1972,11 @@ static NTSTATUS filename_convert_internal(TALLOC_CTX *ctx, return NT_STATUS_NO_MEMORY; } smb_fname->st = (SMB_STRUCT_STAT) { .st_ex_nlink = 1 }; + smb_fname->st.st_ex_btime = (struct timespec){0, SAMBA_UTIME_OMIT}; + smb_fname->st.st_ex_atime = (struct timespec){0, SAMBA_UTIME_OMIT}; + smb_fname->st.st_ex_mtime = (struct timespec){0, SAMBA_UTIME_OMIT}; + smb_fname->st.st_ex_ctime = (struct timespec){0, SAMBA_UTIME_OMIT}; + *_smb_fname = smb_fname; return NT_STATUS_OK; } -- 2.47.3