Dmitry Timoshkov : secur32/tests: Add a test for Negotiate behaviour with SECPKG_ATTR_NEGOTIATION_INFO query.

Alexandre Julliard julliard at winehq.org
Thu Dec 14 15:31:52 CST 2017


Module: wine
Branch: master
Commit: 8d4d7c7251e6f0279757a6f0cba0a654db5fb9c2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8d4d7c7251e6f0279757a6f0cba0a654db5fb9c2

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu Dec 14 17:17:02 2017 +0800

secur32/tests: Add a test for Negotiate behaviour with SECPKG_ATTR_NEGOTIATION_INFO query.

To show that QueryContextAttributes(SECPKG_ATTR_NEGOTIATION_INFO)
allocates flat memory block for the PackageInfo structure.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/secur32/tests/negotiate.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/dlls/secur32/tests/negotiate.c b/dlls/secur32/tests/negotiate.c
index a1c430d..2f1228c 100644
--- a/dlls/secur32/tests/negotiate.c
+++ b/dlls/secur32/tests/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:




More information about the wine-cvs mailing list