int TestNTLM(int argc, char* argv[])
{
int status;
+ int rc = -1;
PSecBuffer pSecBuffer;
- TEST_NTLM_CLIENT* client;
- TEST_NTLM_SERVER* server;
+ TEST_NTLM_CLIENT* client = NULL;
+ TEST_NTLM_SERVER* server = NULL;
BOOL DynamicTest = TRUE;
+
+ WINPR_UNUSED(argc);
+ WINPR_UNUSED(argv);
+
/**
* Client Initialization
*/
if (!client)
{
printf("Memory allocation failed");
- return -1;
+ goto fail;
}
status = test_ntlm_client_init(client, TEST_NTLM_USER, TEST_NTLM_DOMAIN, TEST_NTLM_PASSWORD);
if (status < 0)
{
printf("test_ntlm_client_init failure\n");
- return -1;
+ goto fail;
}
/**
if (!server)
{
printf("Memory allocation failed\n");
- return -1;
+ goto fail;
}
status = test_ntlm_server_init(server);
if (status < 0)
{
printf("test_ntlm_server_init failure\n");
- return -1;
+ goto fail;
}
/**
if (status < 0)
{
printf("test_ntlm_client_authenticate failure\n");
- return -1;
+ goto fail;
}
if (!DynamicTest)
if (!pSecBuffer->pvBuffer)
{
printf("Memory allocation failed\n");
- return -1;
+ goto fail;
}
CopyMemory(pSecBuffer->pvBuffer, TEST_NTLM_NEGOTIATE, pSecBuffer->cbBuffer);
if (status < 0)
{
printf("test_ntlm_server_authenticate failure\n");
- return -1;
+ goto fail;
}
if (!DynamicTest)
if (!pSecBuffer->pvBuffer)
{
printf("Memory allocation failed\n");
- return -1;
+ goto fail;
}
CopyMemory(pSecBuffer->pvBuffer, TEST_NTLM_CHALLENGE, pSecBuffer->cbBuffer);
if (status < 0)
{
printf("test_ntlm_client_authenticate failure\n");
- return -1;
+ goto fail;
}
pSecBuffer = &(client->outputBuffer[0]);
if (!pSecBuffer->pvBuffer)
{
printf("Memory allocation failed\n");
- return -1;
+ goto fail;
}
CopyMemory(pSecBuffer->pvBuffer, TEST_NTLM_AUTHENTICATE, pSecBuffer->cbBuffer);
if (status < 0)
{
printf("test_ntlm_server_authenticate failure\n");
- return -1;
+ goto fail;
}
+ rc = 0;
+
+fail:
/**
* Cleanup & Termination
*/
test_ntlm_client_free(client);
test_ntlm_server_free(server);
- return 0;
+ return rc;
}