Author: jmcd
Date: 2007-03-01 20:52:14 +0000 (Thu, 01 Mar 2007)
New Revision: 21637

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21637

Log:
Get "password never expires" account policy working.
0x8000000000000000LL is "infinity" to NT and should
not be converted numerically to time_t.


Modified:
   branches/SAMBA_3_0/source/lib/time.c
   branches/SAMBA_3_0_25/source/lib/time.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/time.c
===================================================================
--- branches/SAMBA_3_0/source/lib/time.c        2007-03-01 19:22:31 UTC (rev 
21636)
+++ branches/SAMBA_3_0/source/lib/time.c        2007-03-01 20:52:14 UTC (rev 
21637)
@@ -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 @@
                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 @@
                
        if (t == (time_t)-1) {
                /* that's what NT uses for infinite */
-               *nt = 0x8000000000000000LL;
+               *nt = NTTIME_INFINITY;
                return;
        }               
 
@@ -1306,7 +1312,7 @@
        if (nttime==0)
                return "Now";
 
-       if (nttime==0x8000000000000000LL)
+       if (nttime==NTTIME_INFINITY)
                return "Never";
 
        high = 65536;   
@@ -1335,7 +1341,7 @@
                return False;
        }
 
-       if (*nt == 0x8000000000000000LL) {
+       if (*nt == NTTIME_INFINITY) {
                return False;
        }
 

Modified: branches/SAMBA_3_0_25/source/lib/time.c
===================================================================
--- branches/SAMBA_3_0_25/source/lib/time.c     2007-03-01 19:22:31 UTC (rev 
21636)
+++ branches/SAMBA_3_0_25/source/lib/time.c     2007-03-01 20:52:14 UTC (rev 
21637)
@@ -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 @@
                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 @@
                
        if (t == (time_t)-1) {
                /* that's what NT uses for infinite */
-               *nt = 0x8000000000000000LL;
+               *nt = NTTIME_INFINITY;
                return;
        }               
 
@@ -1306,7 +1312,7 @@
        if (nttime==0)
                return "Now";
 
-       if (nttime==0x8000000000000000LL)
+       if (nttime==NTTIME_INFINITY)
                return "Never";
 
        high = 65536;   
@@ -1335,7 +1341,7 @@
                return False;
        }
 
-       if (*nt == 0x8000000000000000LL) {
+       if (*nt == NTTIME_INFINITY) {
                return False;
        }
 

Reply via email to