https://git.reactos.org/?p=reactos.git;a=commitdiff;h=46598fe04a39d68d6a9d7f...
commit 46598fe04a39d68d6a9d7fa6ab8de504474d9d5b Author: Amine Khaldi amine.khaldi@reactos.org AuthorDate: Sun Jan 21 22:45:12 2018 +0100 Commit: Amine Khaldi amine.khaldi@reactos.org CommitDate: Sun Jan 21 22:45:12 2018 +0100
[SECUR32_WINETEST] Sync with Wine 3.0. CORE-14225 --- modules/rostests/winetests/secur32/negotiate.c | 18 +++++++- modules/rostests/winetests/secur32/ntlm.c | 64 ++++++++++++++++++++++++-- modules/rostests/winetests/secur32/schannel.c | 14 +++--- 3 files changed, 83 insertions(+), 13 deletions(-)
diff --git a/modules/rostests/winetests/secur32/negotiate.c b/modules/rostests/winetests/secur32/negotiate.c index a1c430d527..2f1228ced2 100644 --- a/modules/rostests/winetests/secur32/negotiate.c +++ b/modules/rostests/winetests/secur32/negotiate.c @@ -284,13 +284,16 @@ static void test_authentication(void)
memset( &info, 0, sizeof(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; ok( info.NegotiationState == SECPKG_NEGOTIATION_COMPLETE, "got %u\n", info.NegotiationState ); 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) || @@ -300,6 +303,19 @@ static void test_authentication(void) 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); +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: diff --git a/modules/rostests/winetests/secur32/ntlm.c b/modules/rostests/winetests/secur32/ntlm.c index 254b668516..c060420a3f 100644 --- a/modules/rostests/winetests/secur32/ntlm.c +++ b/modules/rostests/winetests/secur32/ntlm.c @@ -36,6 +36,29 @@
#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 PSecurityFunctionTableA (SEC_ENTRY * pInitSecurityInterfaceA)(void); 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}}; SEC_WINNT_AUTH_IDENTITY_A id; SecPkgContext_Sizes ctxt_sizes; + SecPkgContext_NegotiationInfoA info; + SecPkgInfoA *pi;
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", 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: cleanupBuffers(&client); cleanupBuffers(&server); @@ -1181,10 +1241,6 @@ end: pDeleteSecurityContext(&client.ctxt); 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[3].pvBuffer); } diff --git a/modules/rostests/winetests/secur32/schannel.c b/modules/rostests/winetests/secur32/schannel.c index 3a2c55db2e..800edd3a7f 100644 --- a/modules/rostests/winetests/secur32/schannel.c +++ b/modules/rostests/winetests/secur32/schannel.c @@ -686,6 +686,7 @@ static void test_communication(void) SecPkgContext_ConnectionInfo conn_info; SecPkgContext_KeyInfoA key_info; CERT_CONTEXT *cert; + SecPkgContext_NegotiationInfoA info;
SecBufferDesc buffers[2]; SecBuffer *buf; @@ -771,6 +772,7 @@ todo_wine ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 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); +todo_wine ok(buffers[0].pBuffers[0].cbBuffer == 0, "Output buffer size was not set to 0.\n");
buffers[0].pBuffers[0].cbBuffer = 0; @@ -780,15 +782,9 @@ todo_wine todo_wine 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); - 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; + status = InitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, NULL, 0, &context, &buffers[0], &attrs, NULL); @@ -863,7 +859,6 @@ todo_wine 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 */, "InitializeSecurityContext failed: %08x\n", status); if(status != SEC_E_OK) { @@ -945,6 +940,9 @@ todo_wine status = pQueryContextAttributesA(&context, SECPKG_ATTR_STREAM_SIZES, &sizes); 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]);
/* Send a simple request so we get data for testing DecryptMessage */