adjust ntlm unit test
@@ -386,6 +386,7 @@ static int test_ntlm_server_authenticate(TEST_NTLM_SERVER* ntlm)
ntlm->outputBuffer[0].BufferType = SECBUFFER_TOKEN;
ntlm->outputBuffer[0].cbBuffer = ntlm->cbMaxToken;
ntlm->outputBuffer[0].pvBuffer = malloc(ntlm->outputBuffer[0].cbBuffer);
+ BOOL hash_set = FALSE;
if (!ntlm->outputBuffer[0].pvBuffer)
return -1;
@@ -395,19 +396,13 @@ static int test_ntlm_server_authenticate(TEST_NTLM_SERVER* ntlm)
ntlm->fContextReq, SECURITY_NATIVE_DREP, &ntlm->context, &ntlm->outputBufferDesc,
&ntlm->pfContextAttr, &ntlm->expiration);
- if ((status == SEC_I_COMPLETE_AND_CONTINUE) || (status == SEC_I_COMPLETE_NEEDED))
+ if (!hash_set && status == SEC_I_CONTINUE_NEEDED)
{
SecPkgContext_AuthIdentity AuthIdentity;
SecPkgContext_AuthNtlmHash AuthNtlmHash;
ZeroMemory(&AuthIdentity, sizeof(SecPkgContext_AuthIdentity));
ZeroMemory(&AuthNtlmHash, sizeof(SecPkgContext_AuthNtlmHash));
- status = ntlm->table->QueryContextAttributes(&ntlm->context, SECPKG_ATTR_AUTH_IDENTITY,
- &AuthIdentity);
- if (status == SEC_E_OK)
- {
- if (strcmp(AuthIdentity.User, TEST_NTLM_USER) == 0)
- {
if (ntlm->UseNtlmV2Hash)
{
AuthNtlmHash.Version = 2;
@@ -422,16 +417,8 @@ static int test_ntlm_server_authenticate(TEST_NTLM_SERVER* ntlm)
status = ntlm->table->SetContextAttributes(
&ntlm->context, SECPKG_ATTR_AUTH_NTLM_HASH, &AuthNtlmHash,
sizeof(SecPkgContext_AuthNtlmHash));
- }
- }
- if (ntlm->table->CompleteAuthToken)
- status = ntlm->table->CompleteAuthToken(&ntlm->context, &ntlm->outputBufferDesc);
-
- if (status == SEC_I_COMPLETE_NEEDED)
- status = SEC_E_OK;
- else if (status == SEC_I_COMPLETE_AND_CONTINUE)
- status = SEC_I_CONTINUE_NEEDED;
+ hash_set = TRUE;
}
if ((status != SEC_E_OK) && (status != SEC_I_CONTINUE_NEEDED))
