Fixed running library from drive different that install drive windows issue.
Added code to not-persist tokens in the miCASA cache.
This commit is contained in:
parent
87082fbdb2
commit
b03293da31
@ -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,
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user