secur32: Use skip for skipped tests, reduce indentation.

This commit is contained in:
Kai Blin 2007-03-03 10:57:21 +01:00 committed by Alexandre Julliard
parent 3f089b4424
commit 0210f5eb1d
1 changed files with 270 additions and 273 deletions

View File

@ -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);
@ -892,11 +896,6 @@ static void testAuth(ULONG data_rep, BOOL fake)
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;
}
@ -1113,11 +1115,6 @@ end:
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)
{