![]() |
RT/krbdev.mit.edu: Ticket #2883 64-bit time_t issues |
Signed in as guest. [Logout] |
|
|
| History | Display mode: [Brief headers] [Full headers] |
|   |   | Sat Jan 15 16:15:07 2005 | jaltman - Ticket created | ||
|   |
Subject: krb5_timeofday() losses data from 64-bit time_t to krb5_int32 on windows, time_t is 64-bit even on 32-bit systems. krb5_timeofday() assigns the 64-bit value to a 32-bit variable. |
Download (untitled) 118b |
|||
|   |   | Sat Jan 15 16:15:20 2005 | jaltman - Component krb5-libs added | ||
|   |   | Sat Jan 15 16:15:21 2005 | jaltman - Version_reported 1.4 added | ||
|   |   | Tue Mar 15 00:49:48 2005 | jaltman - Taken | ||
|   |   | Tue Mar 15 00:50:23 2005 | jaltman - Subject changed from krb5_timeofday() losses data from 64-bit time_t to krb5_int32 conversion to 64-bit time_t issues | ||
|   |   | Tue Mar 15 00:50:23 2005 | jaltman - Target_Version 1.4.1 added | ||
|   |   | Tue Mar 15 01:06:10 2005 | jaltman - Correspondence added | ||
|   |
Here is a list of all 64-bit related warnings generated by the Windows .NET 2005 compiler. c:\src\kerberos\mit-cvs\krb5-head\src\lib\krb5\asn.1\asn1_k_decode.c(288) : warning C4244: '=' : conversion from 'time_t' to 'krb5_timestamp', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\krb5\ccache\cc_mslsa.c(431) : warning C4244: '=' : conversion from 'time_t' to 'krb5_timestamp', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\krb5\ccache\cc_mslsa.c(432) : warning C4244: '=' : conversion from 'time_t' to 'krb5_timestamp', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\krb5\ccache\cc_mslsa.c(433) : warning C4244: '=' : conversion from 'time_t' to 'krb5_timestamp', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\krb5\os\c_ustime.c(52) : warning C4244: '=' : conversion from '__time64_t' to 'krb5_int32', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\krb5\os\sendto_kdc.c(455) : warning C4244: '=' : conversion from '__time64_t' to 'long', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\krb5\os\timeofday.c(50) : warning C4244: '=' : conversion from 'time_t' to 'krb5_int32', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\des425\unix_time.c(43) : warning C4244: '=' : conversion from 'time_t' to 'krb5_ui_4', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\des425\unix_time.c(44) : warning C4244: 'return' : conversion from 'time_t' to 'krb5_ui_4', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\krb4\win_time.c(32) : warning C4244: 'return' : conversion from '__time64_t' to 'unsigned int', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\krb4\win_time.c(116) : warning C4244:'=' : conversion from 'time_t' to 'long', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\windows\cns\tktlist.c(64) : warning C4133: 'function' : incompatible types - from 'long *' to 'const time_t *' c:\src\kerberos\mit-cvs\krb5-head\src\windows\cns\tktlist.c(176) : warning C4244: 'function' : conversion from 'time_t' to 'long', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\windows\cns\tktlist.c(179) : warning C4244: 'function' : conversion from 'time_t' to 'long', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\windows\gss\gss-misc.c(389) : warning C4244: '=' : conversion from '__time64_t' to 'long', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\clients\klist\klist.c(238) : warning C4244: '=' : conversion from 'time_t' to 'krb5_int32', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\windows\gss\gss-misc.c(389) : warning C4244: '=' : conversion from '__time64_t' to 'long', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\clients\klist\klist.c(238) : warning C4244: '=' : conversion from 'time_t' to 'krb5_int32', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\clients\kinit\kinit.c(335) : warning C4244: '=' : conversion from 'time_t' to 'krb5_deltat', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\appl\gss-sample\gss-misc.c(418) : warning C4244: '=' : conversion from '__time64_t' to 'long', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\appl\gssftp\ftp\ftp.c(2317) : warning C4244: '=' : conversion from '__time64_t' to 'long', possible loss of data These are not time_t issues but still: c:\src\kerberos\mit-cvs\krb5-head\src\lib\gssapi\krb5\k5seal.c(246) : warning C4244: 'function' : conversion from 'gssint_uint64' to 'krb5_ui_4', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\gssapi\krb5\k5seal.c(260) : warning C4244: '=' : conversion from 'gssint_uint64' to 'unsigned char', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\gssapi\krb5\k5seal.c(261) : warning C4244: '=' : conversion from 'gssint_uint64' to 'unsigned char', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\gssapi\krb5\k5seal.c(262) : warning C4244: '=' : conversion from 'gssint_uint64' to 'unsigned char', possible loss of data c:\src\kerberos\mit-cvs\krb5-head\src\lib\gssapi\krb5\k5seal.c(263) : warning C4244: '=' : conversion from 'gssint_uint64' to 'unsigned char', possible loss of data |
Download (untitled) 4.1k |
|||
|   |   | Tue Mar 15 01:06:37 2005 | jaltman - Status changed from new to open | ||
|   |   | Tue Mar 15 01:17:19 2005 | jaltman - Ticket 2963 MemberOf ticket 2883. | ||
|   |   | Wed Mar 16 15:22:41 2005 | raeburn - Comments added | ||
|   |
From: Ken Raeburn <raeburn@MIT.EDU> Subject: Re: [krbdev.mit.edu #2883] 64-bit time_t issues Date: Wed, 16 Mar 2005 15:21:28 -0500 To: rt-comment@krbdev.mit.edu RT-Send-Cc: On Mar 15, 2005, at 01:06, Jeffrey Altman via RT wrote: > Here is a list of all 64-bit related warnings generated by the Windows > .NET 2005 compiler. > > > c:\src\kerberos\mit-cvs\krb5- > head\src\lib\krb5\asn.1\asn1_k_decode.c(288) > : warning C4244: '=' : conversion from 'time_t' to 'krb5_timestamp', > possible loss of data Most of the krb5_timestamp issues should probably be dealt with by making krb5_timestamp 64 bits on 64-bit Windows, as we were discussing. Though there might be interesting issues if 64-bit Windows supports 32-bit Windows software, and krb5_timestamp is used in any IPC (CCAPI?) or file formats (ccache, keytab). Which, actually, it appears to be. So maybe this isn't quite so simple after all. > These are not time_t issues but still: > > c:\src\kerberos\mit-cvs\krb5-head\src\lib\gssapi\krb5\k5seal.c(246) : > warning C4244: 'function' : conversion from 'gssint_uint64' to > 'krb5_ui_4', possible loss of data All of these are in code implementing the original GSSAPI mech with 32-bit sequence numbers. So maybe there should be an "assert(seqnum <= 0xffffffff)" but otherwise it's okay. |
Download (untitled) 1.1k |
|||
|   |   | Mon Apr 4 16:32:47 2005 | tlyu - Target_Version 1.4.1 changed to 1.4.2 | ||
|   |   | Fri Jul 22 18:02:28 2005 | tlyu - Target_Version 1.4.2 changed to 1.4.3 | ||
|   |   | Wed Oct 26 18:09:54 2005 | tlyu - Target_Version 1.4.3 changed to 1.5 | ||
|   |   | Sat Nov 5 16:28:41 2005 | jaltman - Correspondence added | ||
|   |
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
|
Download (untitled) 2.2k |
|||
|   |   | Thu Nov 10 17:41:31 2005 | jaltman - Correspondence added | ||
|   |
Ken: This is an improved test for the definition of 32-bit time_t /* To ensure backward compatibility of the ABI use 32-bit time_t on * 32-bit Windows. */ #if _INTEGRAL_MAX_BITS >= 64 && _MSC_VER >= 1400 && !defined(_WIN64) && !defined(_USE_32BIT_TIME_T) #if defined(_TIME_T_DEFINED) || defined(_INC_IO) || defined(_INC_TIME) || defined(_INC_WCHAR) #error time_t has been defined as a 64-bit integer which is incompatible with Kerberos on this platform. #endif /* _TIME_T_DEFINED */ #define _USE_32BIT_TIME_T #endif Jeffrey Altman |
Download (untitled) 538b |
|||
|   |   | Thu Nov 10 20:56:43 2005 | jaltman - Ticket 2883 DependsOn ticket 3236. | ||
|   |   | Thu Nov 10 21:01:15 2005 | jaltman - Correspondence added | ||
|   |
In order to ensure that we do not affect third party application developers that wish to use 64-bit time_t on 32-bit Windows, we will only define _USE_32BIT_TIME_T if win-mac.h is loaded by k5-int.h. This means that we must ensure that our library source files include k5-int.h instead of krb5.h. (see ticket 3236) The current change for win-mac.h now reads: /* To ensure backward compatibility of the ABI use 32-bit time_t on * 32-bit Windows. */ #ifdef _KRB5_INT_H #ifdef KRB5_GENERAL__ #error krb5.h included before k5-int.h #endif /* KRB5_GENERAL__ */ #if _INTEGRAL_MAX_BITS >= 64 && _MSC_VER >= 1400 && !defined(_WIN64) && !defined(_USE_32BIT_TIME_T) #if defined(_TIME_T_DEFINED) || defined(_INC_IO) || defined(_INC_TIME) || defined(_INC_WCHAR) #error time_t has been defined as a 64-bit integer which is incompatible with Kerberos on this platform. #endif /* _TIME_T_DEFINED */ #define _USE_32BIT_TIME_T #endif #endif and we also include the following check in krb5.h to ensure that krb5.h is not loading win-mac.h before k5-int.h would have done so. #ifdef KRB5_GENERAL__ #error krb5.h included before k5-int.h #endif /* KRB5_GENERAL__ */ |
Download (untitled) 1.1k |
|||
|   |   | Mon Nov 14 18:12:29 2005 | tlyu - Target_Version 1.5 changed to 1.4.4 | ||
|   |   | Mon Nov 14 19:16:27 2005 | jaltman - Status changed from open to resolved | ||
|   |   | Mon Nov 14 19:16:27 2005 | jaltman - Correspondence added | ||
|   |
From: jaltman@mit.edu
Subject: CVS Commit
* Correct function prototypes that should have been using
krb5_timestamp in order to prevent type conflicts if
krb5_timestamp ever becomes a 64-bit value
* Force the use of 32-bit time_t with Microsoft's VS 2005
compiler on 32-bit platforms
* Test for inclusion of krb5.h before k5-int.h
Commit By: jaltman
Revision: 17488
Changed Files:
U trunk/src/include/ChangeLog
U trunk/src/include/k5-int.h
U trunk/src/include/krb5.hin
U trunk/src/include/win-mac.h
U trunk/src/lib/krb5/os/ChangeLog
U trunk/src/lib/krb5/os/timeofday.c
U trunk/src/lib/krb5/os/toffset.c
U trunk/src/lib/krb5/os/ustime.c
|
Download (untitled) 636b |
|||
|   |   | Mon Nov 28 16:51:23 2005 | tlyu - Version_Fixed 1.4.4 added | ||
|   |   | Mon Nov 28 16:51:24 2005 | tlyu - Correspondence added | ||
|   |
From: tlyu@mit.edu Subject: CVS Commit pull up r17488 from trunk. This breaks the unix build; corrected by ticket #3236. Commit By: tlyu Revision: 17502 Changed Files: U branches/krb5-1-4/src/include/ChangeLog U branches/krb5-1-4/src/include/k5-int.h U branches/krb5-1-4/src/include/krb5.hin U branches/krb5-1-4/src/include/win-mac.h U branches/krb5-1-4/src/lib/krb5/os/ChangeLog U branches/krb5-1-4/src/lib/krb5/os/timeofday.c U branches/krb5-1-4/src/lib/krb5/os/toffset.c U branches/krb5-1-4/src/lib/krb5/os/ustime.c |
Download (untitled) 501b |
|||