From 22692b44bd7189b3690aaa96d37c3a58df777885 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 8 Jul 2004 05:25:16 +0000 Subject: [PATCH] * cc_mslsa.c: Fix thread safety ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16562 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/ccache/ChangeLog | 4 ++++ src/lib/krb5/ccache/cc_mslsa.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) 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; -- 2.26.2