diff --git a/CASA-auth-token/client/library/cache.c b/CASA-auth-token/client/library/cache.c index c5c22f1d..572abe81 100644 --- a/CASA-auth-token/client/library/cache.c +++ b/CASA-auth-token/client/library/cache.c @@ -41,6 +41,10 @@ typedef struct _WrapperAuthCacheEntry } WrapperAuthCacheEntry, *PWrapperAuthCacheEntry; +// Undocumented CASA Flags +#define CASA_SECRET_PERSIST_FLAG 0x10000000 +#define CASA_SECRET_DO_NOT_PERSIST_FLAG 0x20000000 + //===[ Function prototypes ]=============================================== @@ -154,7 +158,7 @@ CreateAuthTokenCacheEntry( strncat(pKey, pGroupOrHostName, keySize); miCasaStatus = miCASAWriteBinaryKey(g_hCASAContext, - 0, + CASA_SECRET_DO_NOT_PERSIST_FLAG, &sessionKeyChain, &sharedId, (SS_UTF8_T*) pKey, @@ -287,7 +291,7 @@ CreateSessionTokenCacheEntry( if (cacheKeyStrLen <= UINT32_MAX) { miCasaStatus = miCASAWriteBinaryKey(g_hCASAContext, - 0, + CASA_SECRET_DO_NOT_PERSIST_FLAG, &sessionKeyChain, &sharedId, (SS_UTF8_T*) pCacheKey, diff --git a/CASA-auth-token/client/library/windows/dllsup.c b/CASA-auth-token/client/library/windows/dllsup.c index 46fe7ac3..0922162b 100644 --- a/CASA-auth-token/client/library/windows/dllsup.c +++ b/CASA-auth-token/client/library/windows/dllsup.c @@ -36,6 +36,9 @@ char clientConfigFolderPartialPath[]; extern char mechConfigFolderPartialPath[]; +extern +char programFilesFolder[]; + //===[ Manifest constants ]================================================ //===[ Type definitions ]================================================== @@ -128,7 +131,6 @@ BOOL APIENTRY DllMain( //=======================================================================-- { BOOL retStatus = TRUE; - char programFilesFolder[MAX_PATH] = {0}; switch (ul_reason_for_call) { diff --git a/CASA-auth-token/client/library/windows/platform.c b/CASA-auth-token/client/library/windows/platform.c index c512004d..ac7cfd6f 100644 --- a/CASA-auth-token/client/library/windows/platform.c +++ b/CASA-auth-token/client/library/windows/platform.c @@ -64,6 +64,9 @@ char clientConfigFolder[MAX_PATH + sizeof(clientConfigFolderPartialPath)]; char mechConfigFolderPartialPath[] = "Novell\\Casa\\Etc\\Auth\\Mechanisms"; char mechConfigFolder[MAX_PATH + sizeof(mechConfigFolderPartialPath)]; +// Program files folder +char programFilesFolder[MAX_PATH] = {0}; + // Path separator char pathCharString[] = "\\"; @@ -278,14 +281,54 @@ OpenLibrary( // L2 //=======================================================================-- { - LIB_HANDLE libHandle; + LIB_HANDLE libHandle = NULL; + char *pLibPath = NULL; DbgTrace(1, "-OpenLibrary- Start\n", 0); - libHandle = LoadLibrary(pFileName); - if (libHandle == NULL) + // Check for a partial path to the program files folder + if (strlen(pFileName) > strlen("\\Program Files")) { - DbgTrace(0, "-OpenLibrary- Not able to load library, error = %d\n", GetLastError()); + if (_strnicmp(pFileName, "\\Program Files", strlen("\\Program Files")) == 0) + { + // The file name contains a partial path to the program files folder, + // convert it to an absolute path. + char *p = pFileName + strlen("\\Program Files"); + pLibPath = malloc(strlen(programFilesFolder) + strlen(p) + 1); + if (pLibPath) + { + strcpy(pLibPath, programFilesFolder); + strcat(pLibPath, p); + } + else + { + DbgTrace(0, "-OpenLibrary- Buffer allocation failure\n", 0); + } + } + else + { + // Use the path specified + pLibPath = pFileName; + } + } + else + { + // Use the path specified + pLibPath = pFileName; + } + + // Proceed if pLibPath has been setup + if (pLibPath) + { + libHandle = LoadLibrary(pLibPath); + if (libHandle == NULL) + { + DbgTrace(0, "-OpenLibrary- Not able to load library, error = %d\n", GetLastError()); + } + + // Free memory allocated for library path if necessary + if (pLibPath != pFileName) + free(pLibPath); } DbgTrace(1, "-OpenLibrary- End, handle = %08X\n", libHandle);