Fix WinPR SSPI unit tests to always use SSPI function table

This commit is contained in:
Marc-André Moreau 2022-05-31 11:27:17 -04:00 committed by akallabeth
parent 1d5c0be5ec
commit 227aa6a55f
4 changed files with 13 additions and 8 deletions

View File

@ -22,7 +22,7 @@ int TestAcquireCredentialsHandle(int argc, char* argv[])
WINPR_UNUSED(argv);
sspi_GlobalInit();
table = InitSecurityInterface();
table = InitSecurityInterfaceEx(0);
identity.User = (UINT16*)_strdup(test_User);
identity.Domain = (UINT16*)_strdup(test_Domain);
identity.Password = (UINT16*)_strdup(test_Password);

View File

@ -11,13 +11,15 @@ int TestEnumerateSecurityPackages(int argc, char* argv[])
ULONG cPackages;
SECURITY_STATUS status;
SecPkgInfo* pPackageInfo;
SecurityFunctionTable* table;
WINPR_UNUSED(argc);
WINPR_UNUSED(argv);
sspi_GlobalInit();
table = InitSecurityInterfaceEx(0);
status = EnumerateSecurityPackages(&cPackages, &pPackageInfo);
status = table->EnumerateSecurityPackages(&cPackages, &pPackageInfo);
if (status != SEC_E_OK)
{
@ -32,7 +34,7 @@ int TestEnumerateSecurityPackages(int argc, char* argv[])
_tprintf(_T("\"%s\", \"%s\"\n"), pPackageInfo[index].Name, pPackageInfo[index].Comment);
}
FreeContextBuffer(pPackageInfo);
table->FreeContextBuffer(pPackageInfo);
sspi_GlobalFinish();
return 0;

View File

@ -30,8 +30,8 @@ int TestInitializeSecurityContext(int argc, char* argv[])
WINPR_UNUSED(argv);
sspi_GlobalInit();
table = InitSecurityInterface();
status = QuerySecurityPackageInfo(NTLM_SSP_NAME, &pPackageInfo);
table = InitSecurityInterfaceEx(0);
status = table->QuerySecurityPackageInfo(NTLM_SSP_NAME, &pPackageInfo);
if (status != SEC_E_OK)
{
@ -109,7 +109,7 @@ fail:
if (SecIsValidHandle(&credentials))
table->FreeCredentialsHandle(&credentials);
FreeContextBuffer(pPackageInfo);
table->FreeContextBuffer(pPackageInfo);
sspi_GlobalFinish();
return rc;
}

View File

@ -9,12 +9,15 @@ int TestQuerySecurityPackageInfo(int argc, char* argv[])
int rc;
SECURITY_STATUS status;
SecPkgInfo* pPackageInfo;
SecurityFunctionTable* table;
WINPR_UNUSED(argc);
WINPR_UNUSED(argv);
sspi_GlobalInit();
status = QuerySecurityPackageInfo(NTLM_SSP_NAME, &pPackageInfo);
table = InitSecurityInterfaceEx(0);
status = table->QuerySecurityPackageInfo(NTLM_SSP_NAME, &pPackageInfo);
if (status != SEC_E_OK)
rc = -1;
@ -25,7 +28,7 @@ int TestQuerySecurityPackageInfo(int argc, char* argv[])
rc = 0;
}
FreeContextBuffer(pPackageInfo);
table->FreeContextBuffer(pPackageInfo);
sspi_GlobalFinish();
return rc;
}