summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Ross <gwr@nexenta.com>2014-12-02 11:22:30 -0400
committerGordon Ross <gwr@nexenta.com>2015-06-13 13:27:15 -0400
commitb6f078ed90209a1b0e143e0abd10e14a6a2a7397 (patch)
treee694a2c2a88abe3441208b2b0f27f0993d24666f
parent46e1baa6cf6d5432f5fd231bb588df8f9570c858 (diff)
downloadillumos-joyent-b6f078ed90209a1b0e143e0abd10e14a6a2a7397.tar.gz
5993 SMB server fails setting dates earlier than 1970
Reviewed by: Bayard Bell <Bayard.Bell@nexenta.com> Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com> Reviewed by: Matt Barden <matt.barden@nexenta.com> Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Approved by: Robert Mustacchi <rm@joyent.com>
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_kutil.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/usr/src/uts/common/fs/smbsrv/smb_kutil.c b/usr/src/uts/common/fs/smbsrv/smb_kutil.c
index a31865f298..2f0d327fe8 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_kutil.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_kutil.c
@@ -920,6 +920,18 @@ smb_time_nt_to_unix(uint64_t nt_time, timestruc_t *unix_time)
return;
}
+ /*
+ * Can't represent times less than or equal NT_TIME_BIAS,
+ * so convert them to the oldest date we can store.
+ * Note that time zero is "special" being converted
+ * both directions as 0:0 (unix-to-nt, nt-to-unix).
+ */
+ if (nt_time <= NT_TIME_BIAS) {
+ unix_time->tv_sec = 0;
+ unix_time->tv_nsec = 100;
+ return;
+ }
+
nt_time -= NT_TIME_BIAS;
seconds = nt_time / 10000000;
unix_time->tv_sec = seconds;