mirror of
https://github.com/reactos/reactos.git
synced 2025-05-23 02:56:09 +00:00
[SECUR32_WINETEST] Sync with Wine 3.0. CORE-14225
This commit is contained in:
parent
bdbc2cbf9e
commit
46598fe04a
3 changed files with 83 additions and 13 deletions
|
@ -284,13 +284,16 @@ static void test_authentication(void)
|
||||||
|
|
||||||
memset( &info, 0, sizeof(info) );
|
memset( &info, 0, sizeof(info) );
|
||||||
status_c = QueryContextAttributesA( &client.ctxt, SECPKG_ATTR_NEGOTIATION_INFO, &info );
|
status_c = QueryContextAttributesA( &client.ctxt, SECPKG_ATTR_NEGOTIATION_INFO, &info );
|
||||||
ok( status_c == SEC_E_OK, "pQueryContextAttributesA returned %08x\n", status_c );
|
ok( status_c == SEC_E_OK, "QueryContextAttributesA returned %08x\n", status_c );
|
||||||
|
|
||||||
pi = info.PackageInfo;
|
pi = info.PackageInfo;
|
||||||
ok( info.NegotiationState == SECPKG_NEGOTIATION_COMPLETE, "got %u\n", info.NegotiationState );
|
ok( info.NegotiationState == SECPKG_NEGOTIATION_COMPLETE, "got %u\n", info.NegotiationState );
|
||||||
ok( pi != NULL, "expected non-NULL PackageInfo\n" );
|
ok( pi != NULL, "expected non-NULL PackageInfo\n" );
|
||||||
if (pi)
|
if (pi)
|
||||||
{
|
{
|
||||||
|
UINT expected, got;
|
||||||
|
char *eob;
|
||||||
|
|
||||||
ok( pi->fCapabilities == NTLM_BASE_CAPS ||
|
ok( pi->fCapabilities == NTLM_BASE_CAPS ||
|
||||||
pi->fCapabilities == (NTLM_BASE_CAPS|SECPKG_FLAG_READONLY_WITH_CHECKSUM) ||
|
pi->fCapabilities == (NTLM_BASE_CAPS|SECPKG_FLAG_READONLY_WITH_CHECKSUM) ||
|
||||||
pi->fCapabilities == (NTLM_BASE_CAPS|SECPKG_FLAG_RESTRICTED_TOKENS) ||
|
pi->fCapabilities == (NTLM_BASE_CAPS|SECPKG_FLAG_RESTRICTED_TOKENS) ||
|
||||||
|
@ -300,6 +303,19 @@ static void test_authentication(void)
|
||||||
ok( pi->wVersion == 1, "got %u\n", pi->wVersion );
|
ok( pi->wVersion == 1, "got %u\n", pi->wVersion );
|
||||||
ok( pi->wRPCID == RPC_C_AUTHN_WINNT, "got %u\n", pi->wRPCID );
|
ok( pi->wRPCID == RPC_C_AUTHN_WINNT, "got %u\n", pi->wRPCID );
|
||||||
ok( !lstrcmpA( pi->Name, "NTLM" ), "got %s\n", pi->Name );
|
ok( !lstrcmpA( pi->Name, "NTLM" ), "got %s\n", pi->Name );
|
||||||
|
|
||||||
|
expected = sizeof(*pi) + lstrlenA(pi->Name) + 1 + lstrlenA(pi->Comment) + 1;
|
||||||
|
got = HeapSize(GetProcessHeap(), 0, pi);
|
||||||
|
todo_wine
|
||||||
|
ok( got == expected, "got %u, expected %u\n", got, expected );
|
||||||
|
eob = (char *)pi + expected;
|
||||||
|
todo_wine
|
||||||
|
ok( pi->Name + lstrlenA(pi->Name) < eob, "Name doesn't fit into allocated block\n" );
|
||||||
|
todo_wine
|
||||||
|
ok( pi->Comment + lstrlenA(pi->Comment) < eob, "Comment doesn't fit into allocated block\n" );
|
||||||
|
|
||||||
|
status = FreeContextBuffer( pi );
|
||||||
|
ok( status == SEC_E_OK, "FreeContextBuffer error %#x\n", status );
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
|
@ -36,6 +36,29 @@
|
||||||
|
|
||||||
#include "wine/test.h"
|
#include "wine/test.h"
|
||||||
|
|
||||||
|
#define NEGOTIATE_BASE_CAPS ( \
|
||||||
|
SECPKG_FLAG_INTEGRITY | \
|
||||||
|
SECPKG_FLAG_PRIVACY | \
|
||||||
|
SECPKG_FLAG_CONNECTION | \
|
||||||
|
SECPKG_FLAG_MULTI_REQUIRED | \
|
||||||
|
SECPKG_FLAG_EXTENDED_ERROR | \
|
||||||
|
SECPKG_FLAG_IMPERSONATION | \
|
||||||
|
SECPKG_FLAG_ACCEPT_WIN32_NAME | \
|
||||||
|
SECPKG_FLAG_NEGOTIABLE | \
|
||||||
|
SECPKG_FLAG_GSS_COMPATIBLE | \
|
||||||
|
SECPKG_FLAG_LOGON )
|
||||||
|
|
||||||
|
#define NTLM_BASE_CAPS ( \
|
||||||
|
SECPKG_FLAG_INTEGRITY | \
|
||||||
|
SECPKG_FLAG_PRIVACY | \
|
||||||
|
SECPKG_FLAG_TOKEN_ONLY | \
|
||||||
|
SECPKG_FLAG_CONNECTION | \
|
||||||
|
SECPKG_FLAG_MULTI_REQUIRED | \
|
||||||
|
SECPKG_FLAG_IMPERSONATION | \
|
||||||
|
SECPKG_FLAG_ACCEPT_WIN32_NAME | \
|
||||||
|
SECPKG_FLAG_NEGOTIABLE | \
|
||||||
|
SECPKG_FLAG_LOGON )
|
||||||
|
|
||||||
static HMODULE secdll;
|
static HMODULE secdll;
|
||||||
static PSecurityFunctionTableA (SEC_ENTRY * pInitSecurityInterfaceA)(void);
|
static PSecurityFunctionTableA (SEC_ENTRY * pInitSecurityInterfaceA)(void);
|
||||||
static SECURITY_STATUS (SEC_ENTRY * pFreeContextBuffer)(PVOID pv);
|
static SECURITY_STATUS (SEC_ENTRY * pFreeContextBuffer)(PVOID pv);
|
||||||
|
@ -797,6 +820,8 @@ static void testAuth(ULONG data_rep, BOOL fake)
|
||||||
SspiData client = {{0}}, server = {{0}};
|
SspiData client = {{0}}, server = {{0}};
|
||||||
SEC_WINNT_AUTH_IDENTITY_A id;
|
SEC_WINNT_AUTH_IDENTITY_A id;
|
||||||
SecPkgContext_Sizes ctxt_sizes;
|
SecPkgContext_Sizes ctxt_sizes;
|
||||||
|
SecPkgContext_NegotiationInfoA info;
|
||||||
|
SecPkgInfoA *pi;
|
||||||
|
|
||||||
if(pQuerySecurityPackageInfoA( sec_pkg_name, &pkg_info)!= SEC_E_OK)
|
if(pQuerySecurityPackageInfoA( sec_pkg_name, &pkg_info)!= SEC_E_OK)
|
||||||
{
|
{
|
||||||
|
@ -889,6 +914,41 @@ static void testAuth(ULONG data_rep, BOOL fake)
|
||||||
"cbBlockSize should be 0 but is %u\n",
|
"cbBlockSize should be 0 but is %u\n",
|
||||||
ctxt_sizes.cbBlockSize);
|
ctxt_sizes.cbBlockSize);
|
||||||
|
|
||||||
|
memset(&info, 0, sizeof(info));
|
||||||
|
sec_status = QueryContextAttributesA(&client.ctxt, SECPKG_ATTR_NEGOTIATION_INFO, &info);
|
||||||
|
todo_wine
|
||||||
|
ok(sec_status == SEC_E_OK, "QueryContextAttributesA returned %08x\n", sec_status);
|
||||||
|
|
||||||
|
pi = info.PackageInfo;
|
||||||
|
ok(info.NegotiationState == SECPKG_NEGOTIATION_COMPLETE, "got %u\n", info.NegotiationState);
|
||||||
|
todo_wine
|
||||||
|
ok(pi != NULL, "expected non-NULL PackageInfo\n");
|
||||||
|
if (pi)
|
||||||
|
{
|
||||||
|
UINT expected, got;
|
||||||
|
char *eob;
|
||||||
|
|
||||||
|
ok(pi->fCapabilities == NTLM_BASE_CAPS ||
|
||||||
|
pi->fCapabilities == (NTLM_BASE_CAPS|SECPKG_FLAG_READONLY_WITH_CHECKSUM) ||
|
||||||
|
pi->fCapabilities == (NTLM_BASE_CAPS|SECPKG_FLAG_RESTRICTED_TOKENS) ||
|
||||||
|
pi->fCapabilities == (NTLM_BASE_CAPS|SECPKG_FLAG_RESTRICTED_TOKENS|
|
||||||
|
SECPKG_FLAG_APPCONTAINER_CHECKS),
|
||||||
|
"got %08x\n", pi->fCapabilities);
|
||||||
|
ok(pi->wVersion == 1, "got %u\n", pi->wVersion);
|
||||||
|
ok(pi->wRPCID == RPC_C_AUTHN_WINNT, "got %u\n", pi->wRPCID);
|
||||||
|
ok(!lstrcmpA( pi->Name, "NTLM" ), "got %s\n", pi->Name);
|
||||||
|
|
||||||
|
expected = sizeof(*pi) + lstrlenA(pi->Name) + 1 + lstrlenA(pi->Comment) + 1;
|
||||||
|
got = HeapSize(GetProcessHeap(), 0, pi);
|
||||||
|
ok(got == expected, "got %u, expected %u\n", got, expected);
|
||||||
|
eob = (char *)pi + expected;
|
||||||
|
ok(pi->Name + lstrlenA(pi->Name) < eob, "Name doesn't fit into allocated block\n");
|
||||||
|
ok(pi->Comment + lstrlenA(pi->Comment) < eob, "Comment doesn't fit into allocated block\n");
|
||||||
|
|
||||||
|
sec_status = FreeContextBuffer(pi);
|
||||||
|
ok(sec_status == SEC_E_OK, "FreeContextBuffer error %#x\n", sec_status);
|
||||||
|
}
|
||||||
|
|
||||||
tAuthend:
|
tAuthend:
|
||||||
cleanupBuffers(&client);
|
cleanupBuffers(&client);
|
||||||
cleanupBuffers(&server);
|
cleanupBuffers(&server);
|
||||||
|
@ -1181,10 +1241,6 @@ end:
|
||||||
pDeleteSecurityContext(&client.ctxt);
|
pDeleteSecurityContext(&client.ctxt);
|
||||||
pFreeCredentialsHandle(&client.cred);
|
pFreeCredentialsHandle(&client.cred);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, fake_data[0].pvBuffer);
|
|
||||||
HeapFree(GetProcessHeap(), 0, fake_data[1].pvBuffer);
|
|
||||||
HeapFree(GetProcessHeap(), 0, data[0].pvBuffer);
|
|
||||||
HeapFree(GetProcessHeap(), 0, data[1].pvBuffer);
|
|
||||||
HeapFree(GetProcessHeap(), 0, complex_data[1].pvBuffer);
|
HeapFree(GetProcessHeap(), 0, complex_data[1].pvBuffer);
|
||||||
HeapFree(GetProcessHeap(), 0, complex_data[3].pvBuffer);
|
HeapFree(GetProcessHeap(), 0, complex_data[3].pvBuffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -686,6 +686,7 @@ static void test_communication(void)
|
||||||
SecPkgContext_ConnectionInfo conn_info;
|
SecPkgContext_ConnectionInfo conn_info;
|
||||||
SecPkgContext_KeyInfoA key_info;
|
SecPkgContext_KeyInfoA key_info;
|
||||||
CERT_CONTEXT *cert;
|
CERT_CONTEXT *cert;
|
||||||
|
SecPkgContext_NegotiationInfoA info;
|
||||||
|
|
||||||
SecBufferDesc buffers[2];
|
SecBufferDesc buffers[2];
|
||||||
SecBuffer *buf;
|
SecBuffer *buf;
|
||||||
|
@ -771,6 +772,7 @@ todo_wine
|
||||||
ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM,
|
ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM,
|
||||||
0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL);
|
0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL);
|
||||||
ok(status == SEC_E_INVALID_TOKEN, "Expected SEC_E_INVALID_TOKEN, got %08x\n", status);
|
ok(status == SEC_E_INVALID_TOKEN, "Expected SEC_E_INVALID_TOKEN, got %08x\n", status);
|
||||||
|
todo_wine
|
||||||
ok(buffers[0].pBuffers[0].cbBuffer == 0, "Output buffer size was not set to 0.\n");
|
ok(buffers[0].pBuffers[0].cbBuffer == 0, "Output buffer size was not set to 0.\n");
|
||||||
|
|
||||||
buffers[0].pBuffers[0].cbBuffer = 0;
|
buffers[0].pBuffers[0].cbBuffer = 0;
|
||||||
|
@ -780,15 +782,9 @@ todo_wine
|
||||||
todo_wine
|
todo_wine
|
||||||
ok(status == SEC_E_INSUFFICIENT_MEMORY || status == SEC_E_INVALID_TOKEN,
|
ok(status == SEC_E_INSUFFICIENT_MEMORY || status == SEC_E_INVALID_TOKEN,
|
||||||
"Expected SEC_E_INSUFFICIENT_MEMORY or SEC_E_INVALID_TOKEN, got %08x\n", status);
|
"Expected SEC_E_INSUFFICIENT_MEMORY or SEC_E_INVALID_TOKEN, got %08x\n", status);
|
||||||
ok(buffers[0].pBuffers[0].cbBuffer == 0, "Output buffer size was not set to 0.\n");
|
|
||||||
|
|
||||||
status = InitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost",
|
|
||||||
ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM,
|
|
||||||
0, 0, NULL, 0, &context, NULL, &attrs, NULL);
|
|
||||||
todo_wine
|
|
||||||
ok(status == SEC_E_INVALID_TOKEN, "Expected SEC_E_INVALID_TOKEN, got %08x\n", status);
|
|
||||||
|
|
||||||
buffers[0].pBuffers[0].cbBuffer = buf_size;
|
buffers[0].pBuffers[0].cbBuffer = buf_size;
|
||||||
|
|
||||||
status = InitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost",
|
status = InitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost",
|
||||||
ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM,
|
ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM,
|
||||||
0, 0, NULL, 0, &context, &buffers[0], &attrs, NULL);
|
0, 0, NULL, 0, &context, &buffers[0], &attrs, NULL);
|
||||||
|
@ -863,7 +859,6 @@ todo_wine
|
||||||
buffers[1].pBuffers[0].cbBuffer = buf_size;
|
buffers[1].pBuffers[0].cbBuffer = buf_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
ok(buffers[0].pBuffers[0].cbBuffer == 0, "Output buffer size was not set to 0.\n");
|
|
||||||
ok(status == SEC_E_OK || broken(status == SEC_E_INVALID_TOKEN) /* WinNT */,
|
ok(status == SEC_E_OK || broken(status == SEC_E_INVALID_TOKEN) /* WinNT */,
|
||||||
"InitializeSecurityContext failed: %08x\n", status);
|
"InitializeSecurityContext failed: %08x\n", status);
|
||||||
if(status != SEC_E_OK) {
|
if(status != SEC_E_OK) {
|
||||||
|
@ -945,6 +940,9 @@ todo_wine
|
||||||
status = pQueryContextAttributesA(&context, SECPKG_ATTR_STREAM_SIZES, &sizes);
|
status = pQueryContextAttributesA(&context, SECPKG_ATTR_STREAM_SIZES, &sizes);
|
||||||
ok(status == SEC_E_OK, "QueryContextAttributesW(SECPKG_ATTR_STREAM_SIZES) failed: %08x\n", status);
|
ok(status == SEC_E_OK, "QueryContextAttributesW(SECPKG_ATTR_STREAM_SIZES) failed: %08x\n", status);
|
||||||
|
|
||||||
|
status = QueryContextAttributesA(&context, SECPKG_ATTR_NEGOTIATION_INFO, &info);
|
||||||
|
ok(status == SEC_E_UNSUPPORTED_FUNCTION, "QueryContextAttributesA returned %08x\n", status);
|
||||||
|
|
||||||
reset_buffers(&buffers[0]);
|
reset_buffers(&buffers[0]);
|
||||||
|
|
||||||
/* Send a simple request so we get data for testing DecryptMessage */
|
/* Send a simple request so we get data for testing DecryptMessage */
|
||||||
|
|
Loading…
Reference in a new issue