From efd510fa185a75cad9ae2b5352f72f84113b950f Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Thu, 1 Mar 2007 20:52:14 +0000 Subject: r21637: Get "password never expires" account policy working. 0x8000000000000000LL is "infinity" to NT and should not be converted numerically to time_t. (This used to be commit f3a8048a628753990f9c5401b2bb50c19d4f66e3) --- source3/lib/time.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source3/lib/time.c b/source3/lib/time.c index 403fb0594d..3abe233c4f 100644 --- a/source3/lib/time.c +++ b/source3/lib/time.c @@ -36,6 +36,8 @@ #define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN) #endif +#define NTTIME_INFINITY (NTTIME)0x8000000000000000LL + /** External access to time_t_min and time_t_max. **/ @@ -1180,6 +1182,10 @@ time_t nt_time_to_unix_abs(const NTTIME *nt) return (time_t)-1; } + if (*nt == NTTIME_INFINITY) { + return (time_t)-1; + } + /* reverse the time */ /* it's a negative value, turn it to positive */ d=~*nt; @@ -1248,7 +1254,7 @@ void unix_to_nt_time_abs(NTTIME *nt, time_t t) if (t == (time_t)-1) { /* that's what NT uses for infinite */ - *nt = 0x8000000000000000LL; + *nt = NTTIME_INFINITY; return; } @@ -1306,7 +1312,7 @@ const char *display_time(NTTIME nttime) if (nttime==0) return "Now"; - if (nttime==0x8000000000000000LL) + if (nttime==NTTIME_INFINITY) return "Never"; high = 65536; @@ -1335,7 +1341,7 @@ BOOL nt_time_is_set(const NTTIME *nt) return False; } - if (*nt == 0x8000000000000000LL) { + if (*nt == NTTIME_INFINITY) { return False; } -- cgit