summaryrefslogtreecommitdiff
path: root/source3/lib/time.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-02-11 20:00:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:38 -0500
commit0f87a9ada358020874206cf65db5c62a0a83ddbb (patch)
tree8dbd534fc1b2d8f73df7c4cf533333feba06b65e /source3/lib/time.c
parentdaa2d8bd1f724a0016a4542a2038186e2d6b82bc (diff)
downloadsamba-0f87a9ada358020874206cf65db5c62a0a83ddbb.tar.gz
samba-0f87a9ada358020874206cf65db5c62a0a83ddbb.tar.bz2
samba-0f87a9ada358020874206cf65db5c62a0a83ddbb.zip
r5343: Fix for bug#1525. Timestamps interpreted incorrectly on 64-bit time_t values.
Jeremy. (This used to be commit 00f8ac509aaf2f40a067f5fe5c7699ae6f26571e)
Diffstat (limited to 'source3/lib/time.c')
-rw-r--r--source3/lib/time.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/lib/time.c b/source3/lib/time.c
index 5d7628c9d3..84004a099b 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -302,6 +302,8 @@ struct tm *LocalTime(time_t *t)
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 @@ time_t nt_time_to_unix_abs(NTTIME *nt)
/****************************************************************************
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 @@ time_t interpret_long_date(char *p)
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);
}