Don't overwrite creation time if set by make_create_timespec
Ralph Böhme
rb at sernet.de
Mon Mar 10 10:59:41 MDT 2014
Hi
smb2_create calls dos_mode() after calling SMB_VFS_CREATE_FILE(), as a
result the creation time as set by make_create_timespec() is always
overwritten.
Add a check to dos_mode() that tests for st_ex_calculated_birthtime ==
true and only then update the creation time with the value from the
DOS attribute xattr.
Review appreciated. Thanks!
-Ralph
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de,mailto:kontakt@sernet.de
**************************************************************
SerNet auf der CeBIT: 10. - 14. März 2014, Halle 6, Stand G10
Das Neueste rund um SAMBA, verinice, Firewalls und Linux!
Kostenlose Tickets anfordern per Mail an cebit at sernet.de.
**************************************************************
-------------- next part --------------
>From d9bbfe1015aa4f43fbbcf8349d0ee1baff2481cf Mon Sep 17 00:00:00 2001
From: Ralph Boehme <rb at sernet.de>
Date: Fri, 31 Jan 2014 12:31:46 +0100
Subject: [PATCH 3/5] Don't overwrite creation time if was previously set by
make_create_timespec
smb2_create calls dos_mode() after calling SMB_VFS_CREATE_FILE(), as a
result the creation time as set by make_create_timespec() is always
overwritten.
Add a check to dos_mode() that tests for st_ex_calculated_birthtime ==
true and only then update the creation time with the value from the
DOS attribute xattr.
Signed-off-by: Ralph Boehme <rb at sernet.de>
---
source3/smbd/dosmode.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 29cd93e..5c18668 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -311,7 +311,8 @@ static bool get_ea_dos_attribute(connection_struct *conn,
break;
case 1:
dosattr = dosattrib.info.info1.attrib;
- if (!null_nttime(dosattrib.info.info1.create_time)) {
+ if (!null_nttime(dosattrib.info.info1.create_time) &&
+ (smb_fname->st.st_ex_calculated_birthtime == true)) {
struct timespec create_time =
nt_time_to_unix_timespec(
&dosattrib.info.info1.create_time);
@@ -333,7 +334,8 @@ static bool get_ea_dos_attribute(connection_struct *conn,
case 3:
dosattr = dosattrib.info.info3.attrib;
if ((dosattrib.info.info3.valid_flags & XATTR_DOSINFO_CREATE_TIME) &&
- !null_nttime(dosattrib.info.info3.create_time)) {
+ !null_nttime(dosattrib.info.info3.create_time) &&
+ (smb_fname->st.st_ex_calculated_birthtime == true)) {
struct timespec create_time =
nt_time_to_unix_timespec(
&dosattrib.info.info3.create_time);
--
1.8.5.3
More information about the samba-technical
mailing list