Finished the changes where the GetIdenTokenProviderInterface() was moved

to platform independant code.
This commit is contained in:
Juan Carlos Luciani 2006-05-02 03:01:26 +00:00
parent e6bb3b5db9
commit 243d49616a
3 changed files with 84 additions and 12 deletions

View File

@ -46,12 +46,6 @@ typedef struct _IdenTokenProviderModule
//===[ Global variables ]==================================================
//
// Module synchronization mutex
//
pthread_mutex_t g_hModuleMutex = PTHREAD_MUTEX_INITIALIZER;
//
// IdenTokenProviderModule list and syncronization mutex
//
@ -59,7 +53,7 @@ static
LIST_ENTRY g_IdenTokenProviderModuleListHead = {&g_IdenTokenProviderModuleListHead, &g_IdenTokenProviderModuleListHead};
static
pthread_mutex_t g_IdenTokenProviderModuleMutex = PTHREAD_MUTEX_INITIALIZER;
HANDLE g_idenTokenMutex = NULL;
//++=======================================================================
@ -98,7 +92,7 @@ GetIdenTokenProviderInterface(
int32_t idenTokenTypeNameLen = strlen(pIdenTokenTypeName);
// Gain exclusive access to our mutex
pthread_mutex_lock(&g_IdenTokenProviderModuleMutex);
PlatAcquireMutex(g_idenTokenMutex);
// Look if we already have the module in our list
pListEntry = g_IdenTokenProviderModuleListHead.Flink;
@ -240,7 +234,7 @@ GetIdenTokenProviderInterface(
}
// Release exclusive access to our mutex
pthread_mutex_unlock(&g_IdenTokenProviderModuleMutex);
PlatReleaseMutex(g_idenTokenMutex);
// Release config interface instance
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);
}
//++=======================================================================
//++=======================================================================
//++=======================================================================

View File

@ -88,17 +88,23 @@ ConfigIfUninit(void);
//
// Functions exported by identoken.c
//
extern
CasaStatus
GetIdenTokenProviderInterface(
IN const char *pIdenTokenTypeName,
INOUT IdenTokenProviderIf **ppIdenTokenProviderIf);
extern
CasaStatus
IdenTokenInit(void);
extern
void
IdenTokenUninit(void);
//
// Functions exported by platform.c
//
extern
HANDLE
PlatAllocMutex(void);

View File

@ -122,7 +122,18 @@ ValidateAuthToken(
retStatus = PrincipalIfInit();
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
{