r21637: Get "password never expires" account policy working.
authorJim McDonough <jmcd@samba.org>
Thu, 1 Mar 2007 20:52:14 +0000 (20:52 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:18:19 +0000 (12:18 -0500)
0x8000000000000000LL is "infinity" to NT and should
not be converted numerically to time_t.
(This used to be commit f3a8048a628753990f9c5401b2bb50c19d4f66e3)

source3/lib/time.c

index 403fb0594d42d413cfc72e7860382601dbb982bd..3abe233c4ffcdbac9648f4d43b4e0435635c7ec9 100644 (file)
@@ -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;
        }