diff --git a/auth_token/client/engine.c b/auth_token/client/engine.c index cdbe124d..31c8f5ff 100644 --- a/auth_token/client/engine.c +++ b/auth_token/client/engine.c @@ -88,7 +88,7 @@ ObtainSessionToken( pAuthContext = CONTAINING_RECORD(pListEntry, AuthContext, listEntry); // Try to find a cache entry for the auth context - pCacheEntry = FindEntryInAuthCache(pAuthContext->pContext, NULL); + pCacheEntry = FindSessionTokenEntryInCache(pAuthContext->pContext); if (pCacheEntry != NULL) { // Cache entry found, check if it is of use to us. @@ -122,7 +122,7 @@ ObtainSessionToken( // Only try to create cache entry for the auth context if there is not // one already. - pCacheEntry = FindEntryInAuthCache(pAuthContext->pContext, NULL); + pCacheEntry = FindSessionTokenEntryInCache(pAuthContext->pContext); if (pCacheEntry == NULL) { // Get authentication mechanism token @@ -138,7 +138,7 @@ ObtainSessionToken( } // Create a cache entry for the auth context - pCacheEntry = CreateAuthCacheEntry(pAuthContext->pContext, NULL); + pCacheEntry = CreateSessionTokenCacheEntry(pAuthContext->pContext); if (pCacheEntry) { char *pReqMsg = NULL; @@ -146,7 +146,7 @@ ObtainSessionToken( int respLen; int cacheEntryLifetime = retryLifetime; // Initialize to retry in case of failure - // Request auth token for the service + // Authenticate to the ATS pReqMsg = BuildAuthenticateMsg(pAuthContext, pAuthMechToken); if (pReqMsg) { @@ -506,11 +506,11 @@ ObtainAuthToken( AcquireUserMutex(); // Try to find a cache entry for the service - pCacheEntry = FindEntryInAuthCache(pServiceName, pNormalizedHostName); + pCacheEntry = FindAuthTokenEntryInCache(pServiceName, pNormalizedHostName); if (pCacheEntry == NULL) { // No entry found in the cache, create one. - pCacheEntry = CreateAuthCacheEntry(pServiceName, pNormalizedHostName); + pCacheEntry = CreateAuthTokenCacheEntry(pServiceName, pNormalizedHostName); if (pCacheEntry) { int cacheEntryLifetime = retryLifetime; // Initialize to retry in case of failure diff --git a/auth_token/client/internal.h b/auth_token/client/internal.h index b1aef0c1..bd342a90 100644 --- a/auth_token/client/internal.h +++ b/auth_token/client/internal.h @@ -221,9 +221,14 @@ RelGetAuthTokenResp( extern AuthCacheEntry* -CreateAuthCacheEntry( +CreateSessionTokenCacheEntry( + IN const char *pCacheKey); + +extern +AuthCacheEntry* +CreateAuthTokenCacheEntry( IN const char *pCacheKey, - IN const char *pHostName); + IN const char *pGroupOrHostName); extern void @@ -236,9 +241,14 @@ IncAuthCacheEntryRefCount( extern AuthCacheEntry* -FindEntryInAuthCache( +FindSessionTokenEntryInCache( + IN const char *pCacheKey); + +extern +AuthCacheEntry* +FindAuthTokenEntryInCache( IN const char *pCacheKey, - IN const char *pHostName); + IN const char *pGroupOrHostName); extern void diff --git a/auth_token/client/windows/cache.c b/auth_token/client/windows/cache.c index b261acec..8405550a 100644 --- a/auth_token/client/windows/cache.c +++ b/auth_token/client/windows/cache.c @@ -56,6 +56,7 @@ static int g_cacheEntryCount = 0; //++======================================================================= +static AuthCacheEntry* CreateAuthCacheEntry( IN const char *pCacheKeyName, @@ -140,6 +141,47 @@ CreateAuthCacheEntry( } +//++======================================================================= +AuthCacheEntry* +CreateSessionTokenCacheEntry( + IN const char *pCacheKey) +// +// Arguments: +// +// Returns: +// +// Abstract: +// +// Notes: +// +// L2 +//=======================================================================-- +{ + return CreateAuthCacheEntry(pCacheKey, NULL); +} + + +//++======================================================================= +AuthCacheEntry* +CreateAuthTokenCacheEntry( + IN const char *pCacheKey, + IN const char *pGroupOrHostName) +// +// Arguments: +// +// Returns: +// +// Abstract: +// +// Notes: +// +// L2 +//=======================================================================-- +{ + return CreateAuthCacheEntry(pCacheKey, pGroupOrHostName); +} + + //++======================================================================= static void @@ -300,6 +342,7 @@ CacheEntryLifetimeExpired( //++======================================================================= +static AuthCacheEntry* FindEntryInAuthCache( IN const char *pCacheKeyName, @@ -603,6 +646,46 @@ FindEntryInAuthCache( } +//++======================================================================= +AuthCacheEntry* +FindSessionTokenEntryInCache( + IN const char *pCacheKey) +// +// Arguments: +// +// Returns: +// +// Abstract: +// +// Notes: +// +// L2 +//=======================================================================-- +{ + return FindEntryInAuthCache(pCacheKey, NULL); +} + +//++======================================================================= +AuthCacheEntry* +FindAuthTokenEntryInCache( + IN const char *pCacheKey, + IN const char *pGroupOrHostName) +// +// Arguments: +// +// Returns: +// +// Abstract: +// +// Notes: +// +// L2 +//=======================================================================-- +{ + return FindEntryInAuthCache(pCacheKey, pGroupOrHostName); +} + + //++======================================================================= void AddEntryToAuthCache(