Commit 0210f5eb authored by Kai Blin's avatar Kai Blin Committed by Alexandre Julliard

secur32: Use skip for skipped tests, reduce indentation.

parent 3f089b44
......@@ -568,7 +568,7 @@ static void testInitializeSecurityContextFlags()
if(pQuerySecurityPackageInfoA( sec_pkg_name, &pkg_info) != SEC_E_OK)
{
trace("Package not installed, skipping test!\n");
skip("Package not installed, skipping test!\n");
return;
}
......@@ -585,7 +585,7 @@ static void testInitializeSecurityContextFlags()
if((sec_status = setupClient(&client, sec_pkg_name)) != SEC_E_OK)
{
trace("Setting up the client returned %s, skipping test!\n",
skip("Setting up the client returned %s, skipping test!\n",
getSecError(sec_status));
return;
}
......@@ -774,14 +774,17 @@ static void testAuth(ULONG data_rep, BOOL fake)
SspiData client, server;
SEC_WINNT_AUTH_IDENTITY id;
SecPkgContext_Sizes ctxt_sizes;
static char sec_pkg_name[] = "NTLM";
if(pQuerySecurityPackageInfoA( sec_pkg_name, &pkg_info)== SEC_E_OK)
{
static char test_user[] = "testuser",
static char sec_pkg_name[] = "NTLM",
test_user[] = "testuser",
workgroup[] = "WORKGROUP",
test_pass[] = "testpass";
if(pQuerySecurityPackageInfoA( sec_pkg_name, &pkg_info)!= SEC_E_OK)
{
skip("Package not installed, skipping test.\n");
return;
}
pFreeContextBuffer(pkg_info);
id.User = (unsigned char*) test_user;
id.UserLength = strlen((char *) id.User);
......@@ -797,7 +800,7 @@ static void testAuth(ULONG data_rep, BOOL fake)
if(sec_status != SEC_E_OK)
{
trace("Error: Setting up the client returned %s, exiting test!\n",
skip("Error: Setting up the client returned %s, exiting test!\n",
getSecError(sec_status));
pFreeCredentialsHandle(client.cred);
return;
......@@ -810,14 +813,13 @@ static void testAuth(ULONG data_rep, BOOL fake)
if(sec_status != SEC_E_OK)
{
trace("Error: Setting up the server returned %s, exiting test!\n",
skip("Error: Setting up the server returned %s, exiting test!\n",
getSecError(sec_status));
pFreeCredentialsHandle(server.cred);
pFreeCredentialsHandle(client.cred);
return;
}
while(client_stat == SEC_I_CONTINUE_NEEDED && server_stat == SEC_I_CONTINUE_NEEDED)
{
client_stat = runClient(&client, first, data_rep);
......@@ -843,8 +845,12 @@ static void testAuth(ULONG data_rep, BOOL fake)
first = FALSE;
}
if(client_stat == SEC_E_OK)
if(client_stat != SEC_E_OK)
{
skip("Authentication failed, skipping test.\n");
goto tAuthend;
}
sec_status = pQueryContextAttributesA(client.ctxt,
SECPKG_ATTR_SIZES, &ctxt_sizes);
......@@ -863,10 +869,8 @@ static void testAuth(ULONG data_rep, BOOL fake)
ok(ctxt_sizes.cbBlockSize == 0,
"cbBlockSize should be 0 but is %lu\n",
ctxt_sizes.cbBlockSize);
}
else
trace("Authentication failed, skipping test.\n");
tAuthend:
cleanupBuffers(&client);
cleanupBuffers(&server);
......@@ -891,11 +895,6 @@ static void testAuth(ULONG data_rep, BOOL fake)
sec_status = pFreeCredentialsHandle(client.cred);
ok(sec_status == SEC_E_OK, "FreeCredentialsHandle(client) returned %s\n",
getSecError(sec_status));
}
else
{
trace("Package not installed, skipping test.\n");
}
}
static void testSignSeal()
......@@ -912,16 +911,19 @@ static void testSignSeal()
SecBuffer data[2], fake_data[2], complex_data[4];
ULONG qop = 0;
SecPkgContext_Sizes ctxt_sizes;
static char test_user[] = "testuser",
workgroup[] = "WORKGROUP",
test_pass[] = "testpass";
/****************************************************************
* This is basically the same as in testAuth with a fake server,
* as we need a valid, authenticated context.
*/
if(pQuerySecurityPackageInfoA( sec_pkg_name, &pkg_info)== SEC_E_OK)
if(pQuerySecurityPackageInfoA( sec_pkg_name, &pkg_info) != SEC_E_OK)
{
static char test_user[] = "testuser",
workgroup[] = "WORKGROUP",
test_pass[] = "testpass";
skip("Package not installed, skipping test.\n");
return;
}
pFreeContextBuffer(pkg_info);
id.User = (unsigned char*) test_user;
......@@ -938,7 +940,7 @@ static void testSignSeal()
if(sec_status != SEC_E_OK)
{
trace("Error: Setting up the client returned %s, exiting test!\n",
skip("Error: Setting up the client returned %s, exiting test!\n",
getSecError(sec_status));
pFreeCredentialsHandle(client.cred);
return;
......@@ -966,7 +968,7 @@ static void testSignSeal()
if(pQueryContextAttributesA(client.ctxt, SECPKG_ATTR_SIZES,
&ctxt_sizes) != SEC_E_OK)
{
trace("Failed to get context sizes, aborting test.\n");
skip("Failed to get context sizes, aborting test.\n");
goto end;
}
......@@ -1112,11 +1114,6 @@ end:
HeapFree(GetProcessHeap(), 0, data[1].pvBuffer);
HeapFree(GetProcessHeap(), 0, complex_data[1].pvBuffer);
HeapFree(GetProcessHeap(), 0, complex_data[3].pvBuffer);
}
else
{
trace("Package not installed, skipping test.\n");
}
}
START_TEST(ntlm)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment