[krbdev.mit.edu #2883] 64-bit time_t issues

Jeffrey Altman via RT rt-comment at krbdev.mit.edu
Sat Nov 5 16:28:44 EST 2005


I have discovered that I can take care of the immediate 32-bit Windows
platform problem with 64-bit time_t by defining in win-mac.h:

/* To ensure backward compatibility of the ABI use 32-bit time_t on
 * 32-bit Windows.
 */
#if _INTEGRAL_MAX_BITS >= 64
#ifndef _WIN64
#define _USE_32BIT_TIME_T
#endif
#endif

This will force the time_t to be 32-bits on 32-bit Windows.

Looking longer term I am going to recommend we make the following
prototype changes:

--- krb5.hin    (revision 17479)
+++ krb5.hin    (working copy)
@@ -1802,11 +1802,11 @@
 /* From krb5/os but needed but by the outside world */
 krb5_error_code KRB5_CALLCONV krb5_us_timeofday
        (krb5_context,
-               krb5_int32 *,
+               krb5_timestamp *,
                krb5_int32 * );
 krb5_error_code KRB5_CALLCONV krb5_timeofday
        (krb5_context,
-               krb5_int32 * );
+               krb5_timestamp * );
                 /* get all the addresses of this host */
 krb5_error_code KRB5_CALLCONV krb5_os_localaddr
        (krb5_context,
@@ -2275,19 +2275,19 @@
 #endif

 krb5_error_code KRB5_CALLCONV krb5_set_real_time
-       (krb5_context, krb5_int32, krb5_int32);
+       (krb5_context, krb5_timestamp, krb5_int32);

 #if KRB5_PRIVATE
 krb5_error_code krb5_set_debugging_time
-       (krb5_context, krb5_int32, krb5_int32);
+       (krb5_context, krb5_timestamp, krb5_int32);
 krb5_error_code krb5_use_natural_time
        (krb5_context);
 #endif
 krb5_error_code KRB5_CALLCONV krb5_get_time_offsets
-       (krb5_context, krb5_int32 *, krb5_int32 *);
+       (krb5_context, krb5_timestamp *, krb5_int32 *);
 #if KRB5_PRIVATE
 krb5_error_code krb5_set_time_offsets
-       (krb5_context, krb5_int32, krb5_int32);
+       (krb5_context, krb5_timestamp, krb5_int32);
 #endif

 /* str_conv.c */

Currently krb5_timestamp is 32-bits.  Changing the prototypes to
krb5_timestamp will make it more obvious what the impact will be when 
we redefine krb5_timestamp as a 64-bit value.   I believe krb5_timestamp
should be defined in terms of time_t.

Reading RFC 4120 I do not believe there are any bit length restrictions
on the number of seconds represented in a KerberosTime.  Therefore, we
should attempt to remove the restrictions in our own implementation.


Jeffrey Altman


More information about the krb5-bugs mailing list