MS Excel/NT/Samba timestamp - serious problem, bug?

Jeremy Allison jeremy at valinux.com
Tue Jan 25 00:14:49 GMT 2000


Glen Gunsalus wrote:
> 
> A rather distressing timestamp issue (to multiple users here).  Anyone
> seen similar behavior or have a suggestion/solution?
> 
> Problem:
> 
> Opening and closing an excel file (no changes/keystrokes to file) on
> the Samba server causes the file to be saved with time stamp of
> closing.  (There is no autosave set on Excel - also see other info below)

Can you try the following patch to 2.0.6 (this will be in
2.0.7) and report if it fixes your problem.

Thanks,

	Jeremy Allison,
	Samba Team.

-------------------cut here---------------------------------
--- /home/jeremy/tmp/samba-2.0.6/source/smbd/trans2.c   Wed Nov 10 18:36:11 1999
+++ smbd/trans2.c   Tue Dec 21 11:10:31 1999
@@ -1694,14 +1694,25 @@

     case SMB_SET_FILE_BASIC_INFO:
     {
+      /* Patch to do this correctly from Paul Eggert <eggert at twinsun.com>. */
+      time_t write_time;
+      time_t changed_time;
+
       /* Ignore create time at offset pdata. */

       /* access time */
       tvs.actime = interpret_long_date(pdata+8);

-      /* write time + changed time, combined. */
-      tvs.modtime=MIN(interpret_long_date(pdata+16),
-                      interpret_long_date(pdata+24));
+      write_time = interpret_long_date(pdata+16);
+      changed_time = interpret_long_date(pdata+24);
+
+      tvs.modtime = MIN(write_time, changed_time);
+
+      /* Prefer a defined time to an undefined one. */
+      if (tvs.modtime == (time_t)0 || tvs.modtime == (time_t)-1)
+       tvs.modtime = (write_time == (time_t)0 || write_time == (time_t)-1
+                      ? changed_time
+                      : write_time);

 #if 0 /* Needs more testing... */
       /* Test from Luke to prevent Win95 from
-------------------cut here---------------------------------

-- 
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------


More information about the samba mailing list