Modifications to resolve issues found during self-code review.
This commit is contained in:
@@ -72,18 +72,27 @@ AddReference(
|
||||
// L2
|
||||
//=======================================================================--
|
||||
{
|
||||
int refCount;
|
||||
int refCount = 0;
|
||||
PrincipalIfInstance *pPrincipalIfInstance = CONTAINING_RECORD(pIfInstance, PrincipalIfInstance, principalIf);
|
||||
|
||||
DbgTrace(2, "-AddReference- Start\n", 0);
|
||||
|
||||
// Validate input parameter
|
||||
if (pIfInstance == NULL)
|
||||
{
|
||||
DbgTrace(0, "-AddReference- Invalid parameter\n", 0);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Increment the reference count on the object
|
||||
PlatAcquireMutex(g_principalIfMutex);
|
||||
pPrincipalIfInstance->refCount ++;
|
||||
refCount = pPrincipalIfInstance->refCount;
|
||||
PlatReleaseMutex(g_principalIfMutex);
|
||||
|
||||
DbgTrace(2, "-AddReference- End, refCount = %08X\n", refCount);
|
||||
exit:
|
||||
|
||||
DbgTrace(2, "-AddReference- End, refCount = %0X\n", refCount);
|
||||
|
||||
return refCount;
|
||||
}
|
||||
@@ -114,6 +123,13 @@ ReleaseReference(
|
||||
|
||||
DbgTrace(2, "-ReleaseReference- Start\n", 0);
|
||||
|
||||
// Validate input parameter
|
||||
if (pIfInstance == NULL)
|
||||
{
|
||||
DbgTrace(0, "-ReleaseReference- Invalid parameter\n", 0);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Decrement the reference count on the object and determine if it needs to
|
||||
// be released.
|
||||
PlatAcquireMutex(g_principalIfMutex);
|
||||
@@ -136,6 +152,8 @@ ReleaseReference(
|
||||
free(pPrincipalIfInstance);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
DbgTrace(2, "-ReleaseReference- End\n", 0);
|
||||
}
|
||||
|
||||
@@ -176,12 +194,26 @@ GetIdentityId(
|
||||
|
||||
DbgTrace(2, "-GetIdentityId- Start\n", 0);
|
||||
|
||||
// Verify input parameters
|
||||
if (pIfInstance == NULL
|
||||
|| pIdentIdLen == NULL
|
||||
|| (*pIdentIdLen != 0 && pIdentIdBuf == NULL))
|
||||
{
|
||||
DbgTrace(0, "-GetIdentityId- Invalid parameter\n", 0);
|
||||
retStatus = CasaStatusBuild(CASA_SEVERITY_INFORMATIONAL,
|
||||
CASA_FACILITY_AUTHTOKEN,
|
||||
CASA_STATUS_INVALID_PARAMETER);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Just call into the identity token
|
||||
retStatus = pPrincipalIfInstance->pIdenTokenIf->getIdentityId(pPrincipalIfInstance->pIdenTokenIf,
|
||||
pIdentIdBuf,
|
||||
pIdentIdLen);
|
||||
|
||||
DbgTrace(2, "-GetIdentityId- End, retStatus = %08X\n", retStatus);
|
||||
exit:
|
||||
|
||||
DbgTrace(2, "-GetIdentityId- End, retStatus = %0X\n", retStatus);
|
||||
|
||||
return retStatus;
|
||||
}
|
||||
@@ -224,12 +256,26 @@ GetSourceName(
|
||||
|
||||
DbgTrace(2, "-GetSourceName- Start\n", 0);
|
||||
|
||||
// Verify input parameters
|
||||
if (pIfInstance == NULL
|
||||
|| pSourceNameLen == NULL
|
||||
|| (*pSourceNameLen != 0 && pSourceNameBuf == NULL))
|
||||
{
|
||||
DbgTrace(0, "-GetSourceName- Invalid parameter\n", 0);
|
||||
retStatus = CasaStatusBuild(CASA_SEVERITY_INFORMATIONAL,
|
||||
CASA_FACILITY_AUTHTOKEN,
|
||||
CASA_STATUS_INVALID_PARAMETER);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Just call into the identity token
|
||||
retStatus = pPrincipalIfInstance->pIdenTokenIf->getSourceName(pPrincipalIfInstance->pIdenTokenIf,
|
||||
pSourceNameBuf,
|
||||
pSourceNameLen);
|
||||
|
||||
DbgTrace(2, "-GetSourceName- End, retStatus = %08X\n", retStatus);
|
||||
exit:
|
||||
|
||||
DbgTrace(2, "-GetSourceName- End, retStatus = %0X\n", retStatus);
|
||||
|
||||
return retStatus;
|
||||
}
|
||||
@@ -272,12 +318,26 @@ GetSourceUrl(
|
||||
|
||||
DbgTrace(2, "-GetSourceUrl- Start\n", 0);
|
||||
|
||||
// Verify input parameters
|
||||
if (pIfInstance == NULL
|
||||
|| pSourceUrlLen == NULL
|
||||
|| (*pSourceUrlLen != 0 && pSourceUrlBuf == NULL))
|
||||
{
|
||||
DbgTrace(0, "-GetSourceUrl- Invalid parameter\n", 0);
|
||||
retStatus = CasaStatusBuild(CASA_SEVERITY_INFORMATIONAL,
|
||||
CASA_FACILITY_AUTHTOKEN,
|
||||
CASA_STATUS_INVALID_PARAMETER);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Just call into the identity token
|
||||
retStatus = pPrincipalIfInstance->pIdenTokenIf->getSourceUrl(pPrincipalIfInstance->pIdenTokenIf,
|
||||
pSourceUrlBuf,
|
||||
pSourceUrlLen);
|
||||
|
||||
DbgTrace(2, "-GetSourceUrl- End, retStatus = %08X\n", retStatus);
|
||||
exit:
|
||||
|
||||
DbgTrace(2, "-GetSourceUrl- End, retStatus = %0X\n", retStatus);
|
||||
|
||||
return retStatus;
|
||||
}
|
||||
@@ -335,6 +395,21 @@ AttributeEnumerate(
|
||||
|
||||
DbgTrace(2, "-AttributeEnumerate- Start\n", 0);
|
||||
|
||||
// Verify input parameters
|
||||
if (pIfInstance == NULL
|
||||
|| pEnumHandle == NULL
|
||||
|| pAttribNameLen == NULL
|
||||
|| (*pAttribNameLen != 0 && pAttribNameBuf == NULL
|
||||
|| pAttribValueLen == NULL
|
||||
|| (*pAttribValueLen != 0 && pAttribValueBuf == NULL)))
|
||||
{
|
||||
DbgTrace(0, "-AttributeEnumerate- Invalid parameter\n", 0);
|
||||
retStatus = CasaStatusBuild(CASA_SEVERITY_INFORMATIONAL,
|
||||
CASA_FACILITY_AUTHTOKEN,
|
||||
CASA_STATUS_INVALID_PARAMETER);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Just call into the identity token
|
||||
retStatus = pPrincipalIfInstance->pIdenTokenIf->attributeEnumerate(pPrincipalIfInstance->pIdenTokenIf,
|
||||
pEnumHandle,
|
||||
@@ -343,7 +418,9 @@ AttributeEnumerate(
|
||||
pAttribValueBuf,
|
||||
pAttribValueLen);
|
||||
|
||||
DbgTrace(2, "-AttributeEnumerate- End, retStatus = %08X\n", retStatus);
|
||||
exit:
|
||||
|
||||
DbgTrace(2, "-AttributeEnumerate- End, retStatus = %0X\n", retStatus);
|
||||
|
||||
return retStatus;
|
||||
}
|
||||
@@ -409,7 +486,7 @@ GetPrincipalInterface(
|
||||
CASA_STATUS_INSUFFICIENT_RESOURCES);
|
||||
}
|
||||
|
||||
DbgTrace(2, "-GetPrincipalInterface- End, retStatus = %08X\n", retStatus);
|
||||
DbgTrace(2, "-GetPrincipalInterface- End, retStatus = %0X\n", retStatus);
|
||||
|
||||
return retStatus;
|
||||
}
|
||||
@@ -442,7 +519,7 @@ PrincipalIfInit(void)
|
||||
CASA_FACILITY_AUTHTOKEN,
|
||||
CASA_STATUS_INSUFFICIENT_RESOURCES);
|
||||
|
||||
DbgTrace(1, "-PrincipalIfInit- End, retStatus = %08X\n", retStatus);
|
||||
DbgTrace(1, "-PrincipalIfInit- End, retStatus = %0X\n", retStatus);
|
||||
|
||||
return retStatus;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user