Fixed crash that would occur if an RPC would succeed but no without
response data. -This line, and those below, will be ignored-- M client/library/engine.c
This commit is contained in:
parent
b985dd634e
commit
32093affcb
@ -166,23 +166,31 @@ ObtainSessionToken(
|
|||||||
&respLen);
|
&respLen);
|
||||||
if (CASA_SUCCESS(retStatus))
|
if (CASA_SUCCESS(retStatus))
|
||||||
{
|
{
|
||||||
AuthenticateResp *pAuthenticateResp;
|
if (pRespMsg
|
||||||
|
&& respLen != 0)
|
||||||
// Create Authenticate response object
|
|
||||||
retStatus = CreateAuthenticateResp(pRespMsg, respLen, &pAuthenticateResp);
|
|
||||||
if (CASA_SUCCESS(retStatus))
|
|
||||||
{
|
{
|
||||||
// Return the auth token to the caller
|
AuthenticateResp *pAuthenticateResp;
|
||||||
pCacheEntry = CreateSessionTokenCacheEntry(pAuthContext->pContext,
|
|
||||||
retStatus,
|
// Create Authenticate response object
|
||||||
pAuthenticateResp->pToken,
|
retStatus = CreateAuthenticateResp(pRespMsg, respLen, &pAuthenticateResp);
|
||||||
pAuthenticateResp->tokenLifetime,
|
if (CASA_SUCCESS(retStatus))
|
||||||
pCredStoreScope);
|
{
|
||||||
|
// Return the auth token to the caller
|
||||||
pAuthenticateResp->pToken = NULL; // To keep us from freeing the buffer
|
pCacheEntry = CreateSessionTokenCacheEntry(pAuthContext->pContext,
|
||||||
|
retStatus,
|
||||||
// Free the Authenticate response object
|
pAuthenticateResp->pToken,
|
||||||
RelAuthenticateResp(pAuthenticateResp);
|
pAuthenticateResp->tokenLifetime,
|
||||||
|
pCredStoreScope);
|
||||||
|
|
||||||
|
pAuthenticateResp->pToken = NULL; // To keep us from freeing the buffer
|
||||||
|
|
||||||
|
// Free the Authenticate response object
|
||||||
|
RelAuthenticateResp(pAuthenticateResp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DbgTrace(0, "-ObtainSessionToken- Did not receive Authenticate Response data\n", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -330,82 +338,98 @@ ObtainAuthTokenFromServer(
|
|||||||
&respLen);
|
&respLen);
|
||||||
if (CASA_SUCCESS(retStatus))
|
if (CASA_SUCCESS(retStatus))
|
||||||
{
|
{
|
||||||
// Create GetAuthPolicy response object
|
if (pRespMsg
|
||||||
retStatus = CreateGetAuthPolicyResp(pRespMsg, respLen, &pGetAuthPolicyResp);
|
&& respLen != 0)
|
||||||
if (CASA_SUCCESS(retStatus))
|
|
||||||
{
|
{
|
||||||
// Create the AuthPolicy object
|
// Create GetAuthPolicy response object
|
||||||
retStatus = CreateAuthPolicy(pGetAuthPolicyResp->pPolicy,
|
retStatus = CreateGetAuthPolicyResp(pRespMsg, respLen, &pGetAuthPolicyResp);
|
||||||
pGetAuthPolicyResp->policyLen,
|
|
||||||
&pAuthPolicy);
|
|
||||||
if (CASA_SUCCESS(retStatus))
|
if (CASA_SUCCESS(retStatus))
|
||||||
{
|
{
|
||||||
// Now try to obtain a session token
|
// Create the AuthPolicy object
|
||||||
retStatus = ObtainSessionToken(pRpcSession,
|
retStatus = CreateAuthPolicy(pGetAuthPolicyResp->pPolicy,
|
||||||
pAuthPolicy,
|
pGetAuthPolicyResp->policyLen,
|
||||||
(g_pATSHostName != NULL) ? g_pATSHostName : pHostName,
|
&pAuthPolicy);
|
||||||
pCredStoreScope,
|
|
||||||
&pSessionToken);
|
|
||||||
if (CASA_SUCCESS(retStatus))
|
if (CASA_SUCCESS(retStatus))
|
||||||
{
|
{
|
||||||
// Request auth token for the service
|
// Now try to obtain a session token
|
||||||
free(pReqMsg);
|
retStatus = ObtainSessionToken(pRpcSession,
|
||||||
pReqMsg = BuildGetAuthTokenMsg(pServiceName, "localhost", pSessionToken); // tbd - This will be changed in the future so that we can support services residing in a different host than the ATS
|
pAuthPolicy,
|
||||||
if (pReqMsg)
|
(g_pATSHostName != NULL) ? g_pATSHostName : pHostName,
|
||||||
|
pCredStoreScope,
|
||||||
|
&pSessionToken);
|
||||||
|
if (CASA_SUCCESS(retStatus))
|
||||||
{
|
{
|
||||||
// Free the previous response msg buffer
|
// Request auth token for the service
|
||||||
free(pRespMsg);
|
free(pReqMsg);
|
||||||
pRespMsg = NULL;
|
pReqMsg = BuildGetAuthTokenMsg(pServiceName, "localhost", pSessionToken); // tbd - This will be changed in the future so that we can support services residing in a different host than the ATS
|
||||||
|
if (pReqMsg)
|
||||||
// Issue rpc
|
|
||||||
retStatus = Rpc(pRpcSession,
|
|
||||||
"GetAuthToken",
|
|
||||||
g_rpcFlags,
|
|
||||||
pReqMsg,
|
|
||||||
&pRespMsg,
|
|
||||||
&respLen);
|
|
||||||
if (CASA_SUCCESS(retStatus))
|
|
||||||
{
|
{
|
||||||
// Create GetAuthPolicy response object
|
// Free the previous response msg buffer
|
||||||
retStatus = CreateGetAuthTokenResp(pRespMsg, respLen, &pGetAuthTokenResp);
|
free(pRespMsg);
|
||||||
|
pRespMsg = NULL;
|
||||||
|
|
||||||
|
// Issue rpc
|
||||||
|
retStatus = Rpc(pRpcSession,
|
||||||
|
"GetAuthToken",
|
||||||
|
g_rpcFlags,
|
||||||
|
pReqMsg,
|
||||||
|
&pRespMsg,
|
||||||
|
&respLen);
|
||||||
if (CASA_SUCCESS(retStatus))
|
if (CASA_SUCCESS(retStatus))
|
||||||
{
|
{
|
||||||
// Return the auth token to the caller
|
if (pRespMsg
|
||||||
*ppAuthToken = pGetAuthTokenResp->pToken;
|
&& respLen != 0)
|
||||||
pGetAuthTokenResp->pToken = NULL; // To keep us from freeing the buffer
|
{
|
||||||
*pTokenLifetime = pGetAuthTokenResp->tokenLifetime;
|
// Create GetAuthPolicy response object
|
||||||
|
retStatus = CreateGetAuthTokenResp(pRespMsg, respLen, &pGetAuthTokenResp);
|
||||||
|
if (CASA_SUCCESS(retStatus))
|
||||||
|
{
|
||||||
|
// Return the auth token to the caller
|
||||||
|
*ppAuthToken = pGetAuthTokenResp->pToken;
|
||||||
|
pGetAuthTokenResp->pToken = NULL; // To keep us from freeing the buffer
|
||||||
|
*pTokenLifetime = pGetAuthTokenResp->tokenLifetime;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DbgTrace(0, "-ObtainAuthTokenFromServer- Failed to create GetAuthTokenResp object, error = %08X\n", retStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DbgTrace(0, "-ObtainAuthTokenFromServer- Did not receive GetAuthToken Response data\n", 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DbgTrace(0, "-ObtainAuthTokenFromServer- Failed to create GetAuthTokenResp object, error = %08X\n", retStatus);
|
DbgTrace(0, "-ObtainAuthTokenFromServer- GetAuthToken Rpc failure, error = %08X\n", retStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DbgTrace(0, "-ObtainAuthTokenFromServer- GetAuthToken Rpc failure, error = %08X\n", retStatus);
|
DbgTrace(0, "-ObtainAuthTokenFromServer- Error building GetAuthToken msg\n", 0);
|
||||||
|
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
|
||||||
|
CASA_FACILITY_AUTHTOKEN,
|
||||||
|
CASA_STATUS_INSUFFICIENT_RESOURCES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DbgTrace(0, "-ObtainAuthTokenFromServer- Error building GetAuthToken msg\n", 0);
|
DbgTrace(0, "-ObtainAuthTokenFromServer- Failed to obtain session token, error = %08X\n", retStatus);
|
||||||
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
|
|
||||||
CASA_FACILITY_AUTHTOKEN,
|
|
||||||
CASA_STATUS_INSUFFICIENT_RESOURCES);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DbgTrace(0, "-ObtainAuthTokenFromServer- Failed to obtain session token, error = %08X\n", retStatus);
|
DbgTrace(0, "-ObtainAuthTokenFromServer- Failed to create AuthPolicy object, error = %08X\n", retStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DbgTrace(0, "-ObtainAuthTokenFromServer- Failed to create AuthPolicy object, error = %08X\n", retStatus);
|
DbgTrace(0, "-ObtainAuthTokenFromServer- Failed to create GetAuthPolicyResp object, error = %08X\n", retStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DbgTrace(0, "-ObtainAuthTokenFromServer- Failed to create GetAuthPolicyResp object, error = %08X\n", retStatus);
|
DbgTrace(0, "-ObtainAuthTokenFromServer- Did not receive GetAuthPolicy Response data\n", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user