... to show that QueryContextAttributes(SECPKG_ATTR_NEGOTIATION_INFO) allocates flat memory block for the PackageInfo structure.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/secur32/tests/ntlm.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
diff --git a/dlls/secur32/tests/ntlm.c b/dlls/secur32/tests/ntlm.c index 355af5ad6f..c060420a3f 100644 --- a/dlls/secur32/tests/ntlm.c +++ b/dlls/secur32/tests/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);