svn commit: samba r5343 - in branches/SAMBA_3_0/source: lib smbd

jra at samba.org jra at samba.org
Fri Feb 11 20:00:31 GMT 2005


Author: jra
Date: 2005-02-11 20:00:30 +0000 (Fri, 11 Feb 2005)
New Revision: 5343

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5343

Log:
Fix for bug#1525. Timestamps interpreted incorrectly on 64-bit time_t values.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/time.c
   branches/SAMBA_3_0/source/smbd/trans2.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/time.c
===================================================================
--- branches/SAMBA_3_0/source/lib/time.c	2005-02-11 19:31:48 UTC (rev 5342)
+++ branches/SAMBA_3_0/source/lib/time.c	2005-02-11 20:00:30 UTC (rev 5343)
@@ -302,6 +302,8 @@
  Interpret an 8 byte "filetime" structure to a time_t
  It's originally in "100ns units since jan 1st 1601"
 
+ An 8 byte value of 0xffffffffffffffff will be returned as (time_t)0.
+
  It appears to be kludge-GMT (at least for file listings). This means
  its the GMT you get by taking a localtime and adding the
  serverzone. This is NOT the same as GMT in some cases. This routine
@@ -385,6 +387,8 @@
 
 /****************************************************************************
  Interprets an nt time into a unix time_t.
+ Differs from nt_time_to_unix in that an 8 byte value of 0xffffffffffffffff
+ will be returned as (time_t)-1, whereas nt_time_to_unix returns 0 in this case.
 ****************************************************************************/
 
 time_t interpret_long_date(char *p)
@@ -392,6 +396,9 @@
 	NTTIME nt;
 	nt.low = IVAL(p,0);
 	nt.high = IVAL(p,4);
+	if (nt.low == 0xFFFFFFFF && nt.high == 0xFFFFFFFF) {
+		return (time_t)-1;
+	}
 	return nt_time_to_unix(&nt);
 }
 

Modified: branches/SAMBA_3_0/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/trans2.c	2005-02-11 19:31:48 UTC (rev 5342)
+++ branches/SAMBA_3_0/source/smbd/trans2.c	2005-02-11 20:00:30 UTC (rev 5343)
@@ -801,21 +801,6 @@
 }
 
 /****************************************************************************
- Checks for SMB_TIME_NO_CHANGE and if not found calls interpret_long_date.
-****************************************************************************/
-
-time_t interpret_long_unix_date(char *p)
-{
-	DEBUG(10,("interpret_long_unix_date\n"));
-	if(IVAL(p,0) == SMB_TIME_NO_CHANGE_LO &&
-	   IVAL(p,4) == SMB_TIME_NO_CHANGE_HI) {
-		return -1;
-	} else {
-		return interpret_long_date(p);
-	}
-}
-
-/****************************************************************************
  Get a level dependent lanman2 dir entry.
 ****************************************************************************/
 
@@ -3331,7 +3316,7 @@
 
 			tvs.modtime = MIN(write_time, changed_time);
 
-			if (write_time > tvs.modtime && write_time != 0xffffffff) {
+			if (write_time > tvs.modtime && write_time != (time_t)-1) {
 				tvs.modtime = write_time;
 			}
 			/* Prefer a defined time to an undefined one. */
@@ -3510,8 +3495,8 @@
 #endif /* LARGE_SMB_OFF_T */
 			}
 			pdata+=24;          /* ctime & st_blocks are not changed */
-			tvs.actime = interpret_long_unix_date(pdata); /* access_time */
-			tvs.modtime = interpret_long_unix_date(pdata+8); /* modification_time */
+			tvs.actime = interpret_long_date(pdata); /* access_time */
+			tvs.modtime = interpret_long_date(pdata+8); /* modification_time */
 			pdata+=16;
 			set_owner = (uid_t)IVAL(pdata,0);
 			pdata += 8;



More information about the samba-cvs mailing list