summaryrefslogtreecommitdiff
path: root/source3/smbd/trans2.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-11-20 21:24:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:24 -0500
commit9038a56f82e1352c9d7956af08b70a0b8d3cc773 (patch)
tree5af01a73059fd7d9b7986f040dce225cc2496938 /source3/smbd/trans2.c
parent9604545ed841bd59b4844d9e96094b4193fd1cd5 (diff)
downloadsamba-9038a56f82e1352c9d7956af08b70a0b8d3cc773.tar.gz
samba-9038a56f82e1352c9d7956af08b70a0b8d3cc773.tar.bz2
samba-9038a56f82e1352c9d7956af08b70a0b8d3cc773.zip
r3895: Fix for bug #2045. May also fix other timestamp bugs with Excel
(Volker please test). Setting a last write timestamp from Windows overrides any subsequent write timestamp changes and must be immediately seen by and findfirst/findnexts. This is a racy solution, but should work most of the time. This may also fix #1061, not sure. Jeremy. (This used to be commit 47bab92c0b062f3fefbb4fd4a09852e1c829a7f9)
Diffstat (limited to 'source3/smbd/trans2.c')
-rw-r--r--source3/smbd/trans2.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 633325638a..b877f7c518 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -2540,6 +2540,11 @@ static int call_trans2qfilepathinfo(connection_struct *conn, char *inbuf, char *
c_time = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn)));
+ if (fsp && fsp->pending_modtime) {
+ /* the pending modtime overrides the current modtime */
+ sbuf.st_mtime = fsp->pending_modtime;
+ }
+
if (lp_dos_filetime_resolution(SNUM(conn))) {
c_time &= ~1;
sbuf.st_atime &= ~1;
@@ -3904,10 +3909,12 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
if(fsp != NULL) {
/*
* This was a setfileinfo on an open file.
- * NT does this a lot. It's actually pointless
- * setting the time here, as it will be overwritten
- * on the next write, so we save the request
- * away and will set it on file close. JRA.
+ * NT does this a lot. We also need to
+ * set the time here, as it can be read by
+ * FindFirst/FindNext and with the patch for bug #2045
+ * in smbd/fileio.c it ensures that this timestamp is
+ * kept sticky even after a write. We save the request
+ * away and will set it on file close and after a write. JRA.
*/
if (tvs.modtime != (time_t)0 && tvs.modtime != (time_t)-1) {
@@ -3915,12 +3922,11 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
fsp->pending_modtime = tvs.modtime;
}
- } else {
-
DEBUG(10,("call_trans2setfilepathinfo: setting utimes to modified values.\n"));
- if(file_utime(conn, fname, &tvs)!=0)
+ if(file_utime(conn, fname, &tvs)!=0) {
return(UNIXERROR(ERRDOS,ERRnoaccess));
+ }
}
}