diff options
author | Jim McDonough <jmcd@samba.org> | 2007-03-01 20:52:14 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:18:19 -0500 |
commit | efd510fa185a75cad9ae2b5352f72f84113b950f (patch) | |
tree | 4ae97363c4acae886ee6ba7a3b59ce6c8fc44d4e /source3/lib/time.c | |
parent | cfecca614f563e503a517ca86748e3e90dcdeca4 (diff) | |
download | samba-efd510fa185a75cad9ae2b5352f72f84113b950f.tar.gz samba-efd510fa185a75cad9ae2b5352f72f84113b950f.tar.xz samba-efd510fa185a75cad9ae2b5352f72f84113b950f.zip |
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)
Diffstat (limited to 'source3/lib/time.c')
-rw-r--r-- | source3/lib/time.c | 12 |
1 files 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; } |