From: Jeffrey Altman Date: Thu, 8 Jul 2004 05:25:16 +0000 (+0000) Subject: * cc_mslsa.c: Fix thread safety X-Git-Tag: krb5-1.4-beta1~240 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=22692b44bd7189b3690aaa96d37c3a58df777885;p=krb5.git * cc_mslsa.c: Fix thread safety ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16562 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/ChangeLog b/src/lib/krb5/ccache/ChangeLog index a239e0b4a..c303df8ff 100644 --- a/src/lib/krb5/ccache/ChangeLog +++ b/src/lib/krb5/ccache/ChangeLog @@ -1,3 +1,7 @@ +2004-07-07 Jeffrey Altman + + * cc_mslsa.c: Fix thread safety + 2004-07-07 Jeffrey Altman * cc_mslsa.c: When obtaining a TGT from MSLSA, do not ignore diff --git a/src/lib/krb5/ccache/cc_mslsa.c b/src/lib/krb5/ccache/cc_mslsa.c index 8fd278ec1..0a8b7d33b 100644 --- a/src/lib/krb5/ccache/cc_mslsa.c +++ b/src/lib/krb5/ccache/cc_mslsa.c @@ -68,6 +68,13 @@ #define MAX_MSG_SIZE 256 #define MAX_MSPRINC_SIZE 1024 +/* THREAD SAFETY + * The functions is_windows_2000(), is_windows_xp(), and does_retrieve_ticket_cache_ticket() + * contain static variables to cache the responses of the tests being performed. There is + * no harm in the test being performed more than once since the result will always be the + * same. + */ + static BOOL is_windows_2000 (void) { @@ -77,7 +84,6 @@ is_windows_2000 (void) if (!fChecked) { OSVERSIONINFO Version; - fChecked = TRUE; memset (&Version, 0x00, sizeof(Version)); Version.dwOSVersionInfoSize = sizeof(Version); @@ -88,6 +94,7 @@ is_windows_2000 (void) Version.dwMajorVersion >= 5) fIsWin2K = TRUE; } + fChecked = TRUE; } return fIsWin2K; @@ -102,7 +109,6 @@ is_windows_xp (void) if (!fChecked) { OSVERSIONINFO Version; - fChecked = TRUE; memset (&Version, 0x00, sizeof(Version)); Version.dwOSVersionInfoSize = sizeof(Version); @@ -114,6 +120,7 @@ is_windows_xp (void) Version.dwMajorVersion == 5 && Version.dwMinorVersion >= 1) ) fIsWinXP = TRUE; } + fChecked = TRUE; } return fIsWinXP; @@ -437,7 +444,6 @@ does_retrieve_ticket_cache_ticket (void) PKERB_RETRIEVE_TKT_RESPONSE pTicketResponse = NULL; ULONG ResponseSize; - fChecked = TRUE; RequestSize = sizeof(*pTicketRequest) + 1; if (!PackageConnectLookup(&LogonHandle, &PackageId)) @@ -476,6 +482,7 @@ does_retrieve_ticket_cache_ticket (void) if ( SubStatus == STATUS_NOT_SUPPORTED ) fCachesTicket = TRUE; } + fChecked = TRUE; } return fCachesTicket;