Fixed some build problems introduced with the mechanism_info changes.
This commit is contained in:
parent
e1001dfc6f
commit
1d1803ffb6
@ -87,7 +87,7 @@ CasaStatus
|
|||||||
(SSCS_CALL *PFNAuthTokenIf_GetAuthToken)(
|
(SSCS_CALL *PFNAuthTokenIf_GetAuthToken)(
|
||||||
IN const void *pIfInstance,
|
IN const void *pIfInstance,
|
||||||
IN const char *pContext,
|
IN const char *pContext,
|
||||||
IN const char *pMechInfo,
|
IN char *pMechInfo,
|
||||||
IN const char *pHostName,
|
IN const char *pHostName,
|
||||||
IN void *pCredStoreScope,
|
IN void *pCredStoreScope,
|
||||||
INOUT char *pTokenBuf,
|
INOUT char *pTokenBuf,
|
||||||
|
@ -125,7 +125,7 @@ CasaStatus SSCS_CALL
|
|||||||
AuthTokenIf_GetAuthToken(
|
AuthTokenIf_GetAuthToken(
|
||||||
IN const void *pIfInstance,
|
IN const void *pIfInstance,
|
||||||
IN const char *pContext,
|
IN const char *pContext,
|
||||||
IN const char *pMechInfo,
|
IN char *pMechInfo,
|
||||||
IN const char *pHostName,
|
IN const char *pHostName,
|
||||||
IN void *pCredStoreScope,
|
IN void *pCredStoreScope,
|
||||||
INOUT char *pTokenBuf,
|
INOUT char *pTokenBuf,
|
||||||
@ -186,7 +186,8 @@ AuthTokenIf_GetAuthToken(
|
|||||||
//=======================================================================--
|
//=======================================================================--
|
||||||
{
|
{
|
||||||
CasaStatus retStatus;
|
CasaStatus retStatus;
|
||||||
char *pKrbServiceName = (char*) pMechInfo;
|
char *pKrbServiceName = NULL;
|
||||||
|
bool freeKrbSvcNameBuf = false;
|
||||||
OM_uint32 gssMajStat;
|
OM_uint32 gssMajStat;
|
||||||
OM_uint32 gssMinStat;
|
OM_uint32 gssMinStat;
|
||||||
gss_buffer_desc gssBuffer;
|
gss_buffer_desc gssBuffer;
|
||||||
@ -209,6 +210,37 @@ AuthTokenIf_GetAuthToken(
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Process any mechanism information that may have been provided
|
||||||
|
if (pMechInfo)
|
||||||
|
{
|
||||||
|
// Mechanism information has been provided. Mechanism information
|
||||||
|
// consists of semicolon delimited settings. The settings are formated
|
||||||
|
// using the format settingName=settingvalue. No white space is allowed
|
||||||
|
// as part of the mechanism information.
|
||||||
|
char *pNextSettingToken;
|
||||||
|
char *pSettingValueToken = strtok_s(pMechInfo, ";", &pNextSettingToken);
|
||||||
|
while (pSettingValueToken != NULL)
|
||||||
|
{
|
||||||
|
char *pNextToken;
|
||||||
|
char *pSettingName = strtok_r(pSettingValueToken, "=", &pNextToken);
|
||||||
|
char *pSettingValue = strtok_r(NULL, "=", &pNextToken);
|
||||||
|
if (pSettingValue)
|
||||||
|
{
|
||||||
|
// Process the setting
|
||||||
|
if (strcmpi(pSettingName, "SVC_PRINCIPAL") == 0)
|
||||||
|
{
|
||||||
|
pKrbServiceName = pSettingValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Bad setting\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
pSettingValueToken = strtok_s(NULL, ";", &pNextSettingToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if we need to construct the service name
|
// Check if we need to construct the service name
|
||||||
if (pKrbServiceName == NULL
|
if (pKrbServiceName == NULL
|
||||||
|| strlen(pKrbServiceName) == 0)
|
|| strlen(pKrbServiceName) == 0)
|
||||||
@ -217,6 +249,7 @@ AuthTokenIf_GetAuthToken(
|
|||||||
pKrbServiceName = malloc(5 /*"host/"*/ + strlen(pHostName) + 1 /*'/0'*/);
|
pKrbServiceName = malloc(5 /*"host/"*/ + strlen(pHostName) + 1 /*'/0'*/);
|
||||||
if (pKrbServiceName)
|
if (pKrbServiceName)
|
||||||
{
|
{
|
||||||
|
freeKrbSvcNameBuf = true;
|
||||||
sprintf(pKrbServiceName, "host/%s", pHostName);
|
sprintf(pKrbServiceName, "host/%s", pHostName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -359,8 +392,7 @@ AuthTokenIf_GetAuthToken(
|
|||||||
exit:
|
exit:
|
||||||
|
|
||||||
// Free buffer holding the Krb Service Name if necessary
|
// Free buffer holding the Krb Service Name if necessary
|
||||||
if (pKrbServiceName
|
if (freeKrbSvcNameBuf)
|
||||||
&& pKrbServiceName != pMechInfo)
|
|
||||||
free(pKrbServiceName);
|
free(pKrbServiceName);
|
||||||
|
|
||||||
DbgTrace(1, "-AuthTokenIf_GetAuthToken- End, retStatus = %08X\n", retStatus);
|
DbgTrace(1, "-AuthTokenIf_GetAuthToken- End, retStatus = %08X\n", retStatus);
|
||||||
|
@ -39,7 +39,7 @@ CasaStatus SSCS_CALL
|
|||||||
AuthTokenIf_GetAuthToken(
|
AuthTokenIf_GetAuthToken(
|
||||||
IN const void *pIfInstance,
|
IN const void *pIfInstance,
|
||||||
IN const char *pContext,
|
IN const char *pContext,
|
||||||
IN const char *pMechInfo,
|
IN char *pMechInfo,
|
||||||
IN const char *pHostName,
|
IN const char *pHostName,
|
||||||
IN void *pCredStoreScope,
|
IN void *pCredStoreScope,
|
||||||
INOUT char *pTokenBuf,
|
INOUT char *pTokenBuf,
|
||||||
@ -97,6 +97,7 @@ AuthTokenIf_GetAuthToken(
|
|||||||
{
|
{
|
||||||
CasaStatus retStatus;
|
CasaStatus retStatus;
|
||||||
char *pKrbServiceName = NULL;
|
char *pKrbServiceName = NULL;
|
||||||
|
bool freeKrbSvcNameBuf = false;
|
||||||
SECURITY_STATUS secStatus;
|
SECURITY_STATUS secStatus;
|
||||||
TimeStamp expiry;
|
TimeStamp expiry;
|
||||||
CredHandle hCredentials = {0};
|
CredHandle hCredentials = {0};
|
||||||
@ -130,8 +131,8 @@ AuthTokenIf_GetAuthToken(
|
|||||||
while (pSettingValueToken != NULL)
|
while (pSettingValueToken != NULL)
|
||||||
{
|
{
|
||||||
char *pNextToken;
|
char *pNextToken;
|
||||||
char *pSettingName = strtok_s(pSettingValueToken, "=", &pNextToken);
|
char *pSettingName = strtok_r(pSettingValueToken, "=", &pNextToken);
|
||||||
char *pSettingValue = strtok_s(NULL, "=", &pNextToken);
|
char *pSettingValue = strtok_r(NULL, "=", &pNextToken);
|
||||||
if (pSettingValue)
|
if (pSettingValue)
|
||||||
{
|
{
|
||||||
// Process the setting
|
// Process the setting
|
||||||
@ -157,6 +158,7 @@ AuthTokenIf_GetAuthToken(
|
|||||||
pKrbServiceName = malloc(5 /*"host/"*/ + strlen(pHostName) + 1 /*'/0'*/);
|
pKrbServiceName = malloc(5 /*"host/"*/ + strlen(pHostName) + 1 /*'/0'*/);
|
||||||
if (pKrbServiceName)
|
if (pKrbServiceName)
|
||||||
{
|
{
|
||||||
|
freeKrbSvcNameBuf = true;
|
||||||
sprintf(pKrbServiceName, "host/%s", pHostName);
|
sprintf(pKrbServiceName, "host/%s", pHostName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -310,8 +312,7 @@ AuthTokenIf_GetAuthToken(
|
|||||||
exit:
|
exit:
|
||||||
|
|
||||||
// Free buffer holding the Krb Service Name if necessary
|
// Free buffer holding the Krb Service Name if necessary
|
||||||
if (pKrbServiceName
|
if (freeKrbSvcNameBuf)
|
||||||
&& pKrbServiceName != pMechInfo)
|
|
||||||
free(pKrbServiceName);
|
free(pKrbServiceName);
|
||||||
|
|
||||||
DbgTrace(1, "-AuthTokenIf_GetAuthToken- End, retStatus = %08X\n", retStatus);
|
DbgTrace(1, "-AuthTokenIf_GetAuthToken- End, retStatus = %08X\n", retStatus);
|
||||||
|
@ -80,6 +80,7 @@ FILE *pDebugFile; \
|
|||||||
#define bool BOOLEAN
|
#define bool BOOLEAN
|
||||||
#define true TRUE
|
#define true TRUE
|
||||||
#define false FALSE
|
#define false FALSE
|
||||||
|
#define strtok_r strtok_s
|
||||||
|
|
||||||
//===[ Inlines functions ]===============================================
|
//===[ Inlines functions ]===============================================
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ CasaStatus SSCS_CALL
|
|||||||
AuthTokenIf_GetAuthToken(
|
AuthTokenIf_GetAuthToken(
|
||||||
IN const void *pIfInstance,
|
IN const void *pIfInstance,
|
||||||
IN const char *pContext,
|
IN const char *pContext,
|
||||||
IN const char *pMechInfo,
|
IN char *pMechInfo,
|
||||||
IN const char *pHostName,
|
IN const char *pHostName,
|
||||||
IN void *pCredStoreScope,
|
IN void *pCredStoreScope,
|
||||||
INOUT char *pTokenBuf,
|
INOUT char *pTokenBuf,
|
||||||
@ -307,12 +307,12 @@ AuthTokenIf_GetAuthToken(
|
|||||||
// using the format settingName=settingvalue. No white space is allowed
|
// using the format settingName=settingvalue. No white space is allowed
|
||||||
// as part of the mechanism information.
|
// as part of the mechanism information.
|
||||||
char *pNextSettingToken;
|
char *pNextSettingToken;
|
||||||
char *pSettingValueToken = strtok_s(pMechInfo, ";", &pNextSettingToken);
|
char *pSettingValueToken = strtok_r(pMechInfo, ";", &pNextSettingToken);
|
||||||
while (pSettingValueToken != NULL)
|
while (pSettingValueToken != NULL)
|
||||||
{
|
{
|
||||||
char *pNextToken;
|
char *pNextToken;
|
||||||
char *pSettingName = strtok_s(pSettingValueToken, "=", &pNextToken);
|
char *pSettingName = strtok_r(pSettingValueToken, "=", &pNextToken);
|
||||||
char *pSettingValue = strtok_s(NULL, "=", &pNextToken);
|
char *pSettingValue = strtok_r(NULL, "=", &pNextToken);
|
||||||
if (pSettingValue)
|
if (pSettingValue)
|
||||||
{
|
{
|
||||||
// Process the setting
|
// Process the setting
|
||||||
|
@ -78,6 +78,7 @@ FILE *pDebugFile; \
|
|||||||
#define bool BOOLEAN
|
#define bool BOOLEAN
|
||||||
#define true TRUE
|
#define true TRUE
|
||||||
#define false FALSE
|
#define false FALSE
|
||||||
|
#define strtok_r strtok_s
|
||||||
|
|
||||||
//===[ Inlines functions ]===============================================
|
//===[ Inlines functions ]===============================================
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user