Finished the changes where the GetIdenTokenProviderInterface() was moved
to platform independant code.
This commit is contained in:
parent
e6bb3b5db9
commit
243d49616a
@ -46,12 +46,6 @@ typedef struct _IdenTokenProviderModule
|
|||||||
|
|
||||||
//===[ Global variables ]==================================================
|
//===[ Global variables ]==================================================
|
||||||
|
|
||||||
//
|
|
||||||
// Module synchronization mutex
|
|
||||||
//
|
|
||||||
pthread_mutex_t g_hModuleMutex = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// IdenTokenProviderModule list and syncronization mutex
|
// IdenTokenProviderModule list and syncronization mutex
|
||||||
//
|
//
|
||||||
@ -59,7 +53,7 @@ static
|
|||||||
LIST_ENTRY g_IdenTokenProviderModuleListHead = {&g_IdenTokenProviderModuleListHead, &g_IdenTokenProviderModuleListHead};
|
LIST_ENTRY g_IdenTokenProviderModuleListHead = {&g_IdenTokenProviderModuleListHead, &g_IdenTokenProviderModuleListHead};
|
||||||
|
|
||||||
static
|
static
|
||||||
pthread_mutex_t g_IdenTokenProviderModuleMutex = PTHREAD_MUTEX_INITIALIZER;
|
HANDLE g_idenTokenMutex = NULL;
|
||||||
|
|
||||||
|
|
||||||
//++=======================================================================
|
//++=======================================================================
|
||||||
@ -98,7 +92,7 @@ GetIdenTokenProviderInterface(
|
|||||||
int32_t idenTokenTypeNameLen = strlen(pIdenTokenTypeName);
|
int32_t idenTokenTypeNameLen = strlen(pIdenTokenTypeName);
|
||||||
|
|
||||||
// Gain exclusive access to our mutex
|
// Gain exclusive access to our mutex
|
||||||
pthread_mutex_lock(&g_IdenTokenProviderModuleMutex);
|
PlatAcquireMutex(g_idenTokenMutex);
|
||||||
|
|
||||||
// Look if we already have the module in our list
|
// Look if we already have the module in our list
|
||||||
pListEntry = g_IdenTokenProviderModuleListHead.Flink;
|
pListEntry = g_IdenTokenProviderModuleListHead.Flink;
|
||||||
@ -240,7 +234,7 @@ GetIdenTokenProviderInterface(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Release exclusive access to our mutex
|
// Release exclusive access to our mutex
|
||||||
pthread_mutex_unlock(&g_IdenTokenProviderModuleMutex);
|
PlatReleaseMutex(g_idenTokenMutex);
|
||||||
|
|
||||||
// Release config interface instance
|
// Release config interface instance
|
||||||
pModuleConfigIf->releaseReference(pModuleConfigIf);
|
pModuleConfigIf->releaseReference(pModuleConfigIf);
|
||||||
@ -259,6 +253,67 @@ GetIdenTokenProviderInterface(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//++=======================================================================
|
||||||
|
CasaStatus
|
||||||
|
IdenTokenInit(void)
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// Casa Status
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Initializes the identity token complex.
|
||||||
|
//
|
||||||
|
// L2
|
||||||
|
//=======================================================================--
|
||||||
|
{
|
||||||
|
CasaStatus retStatus;
|
||||||
|
|
||||||
|
DbgTrace(1, "-IdenTokenInit- Start\n", 0);
|
||||||
|
|
||||||
|
// Allocate mutex
|
||||||
|
if ((g_idenTokenMutex = PlatAllocMutex()) != NULL)
|
||||||
|
retStatus = CASA_STATUS_SUCCESS;
|
||||||
|
else
|
||||||
|
retStatus = CasaStatusBuild(CASA_SEVERITY_INFORMATIONAL,
|
||||||
|
CASA_FACILITY_AUTHTOKEN,
|
||||||
|
CASA_STATUS_INSUFFICIENT_RESOURCES);
|
||||||
|
|
||||||
|
DbgTrace(1, "-IdenTokenInit- End, retStatus = %08X\n", retStatus);
|
||||||
|
|
||||||
|
return retStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//++=======================================================================
|
||||||
|
void
|
||||||
|
IdenTokenUninit(void)
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// Casa Status
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Uninitializes the indentity token complex.
|
||||||
|
//
|
||||||
|
// L2
|
||||||
|
//=======================================================================--
|
||||||
|
{
|
||||||
|
DbgTrace(1, "-IdenTokenUninit- Start\n", 0);
|
||||||
|
|
||||||
|
// Free mutex if necessary
|
||||||
|
if (g_idenTokenMutex)
|
||||||
|
{
|
||||||
|
PlatDestroyMutex(g_idenTokenMutex);
|
||||||
|
g_idenTokenMutex = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
DbgTrace(1, "-IdenTokenUninit- End\n", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//++=======================================================================
|
//++=======================================================================
|
||||||
//++=======================================================================
|
//++=======================================================================
|
||||||
//++=======================================================================
|
//++=======================================================================
|
||||||
|
@ -88,17 +88,23 @@ ConfigIfUninit(void);
|
|||||||
//
|
//
|
||||||
// Functions exported by identoken.c
|
// Functions exported by identoken.c
|
||||||
//
|
//
|
||||||
|
|
||||||
extern
|
extern
|
||||||
CasaStatus
|
CasaStatus
|
||||||
GetIdenTokenProviderInterface(
|
GetIdenTokenProviderInterface(
|
||||||
IN const char *pIdenTokenTypeName,
|
IN const char *pIdenTokenTypeName,
|
||||||
INOUT IdenTokenProviderIf **ppIdenTokenProviderIf);
|
INOUT IdenTokenProviderIf **ppIdenTokenProviderIf);
|
||||||
|
|
||||||
|
extern
|
||||||
|
CasaStatus
|
||||||
|
IdenTokenInit(void);
|
||||||
|
|
||||||
|
extern
|
||||||
|
void
|
||||||
|
IdenTokenUninit(void);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Functions exported by platform.c
|
// Functions exported by platform.c
|
||||||
//
|
//
|
||||||
|
|
||||||
extern
|
extern
|
||||||
HANDLE
|
HANDLE
|
||||||
PlatAllocMutex(void);
|
PlatAllocMutex(void);
|
||||||
|
@ -122,7 +122,18 @@ ValidateAuthToken(
|
|||||||
retStatus = PrincipalIfInit();
|
retStatus = PrincipalIfInit();
|
||||||
if (CASA_SUCCESS(retStatus))
|
if (CASA_SUCCESS(retStatus))
|
||||||
{
|
{
|
||||||
g_moduleInitialized = true;
|
// Initialize the IdenToken complex
|
||||||
|
retStatus = IdenTokenInit();
|
||||||
|
if (CASA_SUCCESS(retStatus))
|
||||||
|
{
|
||||||
|
// Success
|
||||||
|
g_moduleInitialized = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PrincipalIfUninit();
|
||||||
|
ConfigIfUninit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user