Author: akhaldi
Date: Sun Jul 3 11:50:18 2016
New Revision: 71784
URL:
http://svn.reactos.org/svn/reactos?rev=71784&view=rev
Log:
[SECUR32_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368
Modified:
trunk/rostests/winetests/secur32/main.c
trunk/rostests/winetests/secur32/ntlm.c
trunk/rostests/winetests/secur32/schannel.c
Modified: trunk/rostests/winetests/secur32/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/secur32/main.c?…
==============================================================================
--- trunk/rostests/winetests/secur32/main.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/secur32/main.c [iso-8859-1] Sun Jul 3 11:50:18 2016
@@ -162,30 +162,35 @@
for(i = 0; i < num_packages; ++i){
trace("%d: Package \"%s\"\n", i, pkg_info[i].Name);
trace("Supported flags:\n");
- if(pkg_info[i].fCapabilities & SECPKG_FLAG_INTEGRITY)
- trace("\tSECPKG_FLAG_INTEGRITY\n");
- if(pkg_info[i].fCapabilities & SECPKG_FLAG_PRIVACY)
- trace("\tSECPKG_FLAG_PRIVACY\n");
- if(pkg_info[i].fCapabilities & SECPKG_FLAG_TOKEN_ONLY)
- trace("\tSECPKG_FLAG_TOKEN_ONLY\n");
- if(pkg_info[i].fCapabilities & SECPKG_FLAG_DATAGRAM)
- trace("\tSECPKG_FLAG_DATAGRAM\n");
- if(pkg_info[i].fCapabilities & SECPKG_FLAG_CONNECTION)
- trace("\tSECPKG_FLAG_CONNECTION\n");
- if(pkg_info[i].fCapabilities & SECPKG_FLAG_MULTI_REQUIRED)
- trace("\tSECPKG_FLAG_MULTI_REQUIRED\n");
- if(pkg_info[i].fCapabilities & SECPKG_FLAG_CLIENT_ONLY)
- trace("\tSECPKG_FLAG_CLIENT_ONLY\n");
- if(pkg_info[i].fCapabilities & SECPKG_FLAG_EXTENDED_ERROR)
- trace("\tSECPKG_FLAG_EXTENDED_ERROR\n");
- if(pkg_info[i].fCapabilities & SECPKG_FLAG_IMPERSONATION)
- trace("\tSECPKG_FLAG_IMPERSONATION\n");
- if(pkg_info[i].fCapabilities & SECPKG_FLAG_ACCEPT_WIN32_NAME)
- trace("\tSECPKG_FLAG_ACCEPT_WIN32_NAME\n");
- if(pkg_info[i].fCapabilities & SECPKG_FLAG_STREAM)
- trace("\tSECPKG_FLAG_STREAM\n");
- if(pkg_info[i].fCapabilities & SECPKG_FLAG_READONLY_WITH_CHECKSUM)
- trace("\tSECPKG_FLAG_READONLY_WITH_CHECKSUM\n");
+#define X(flag) \
+ if(pkg_info[i].fCapabilities & flag) \
+ trace("\t" #flag "\n")
+
+ X(SECPKG_FLAG_INTEGRITY);
+ X(SECPKG_FLAG_PRIVACY);
+ X(SECPKG_FLAG_TOKEN_ONLY);
+ X(SECPKG_FLAG_DATAGRAM);
+ X(SECPKG_FLAG_CONNECTION);
+ X(SECPKG_FLAG_MULTI_REQUIRED);
+ X(SECPKG_FLAG_CLIENT_ONLY);
+ X(SECPKG_FLAG_EXTENDED_ERROR);
+ X(SECPKG_FLAG_IMPERSONATION);
+ X(SECPKG_FLAG_ACCEPT_WIN32_NAME);
+ X(SECPKG_FLAG_STREAM);
+ X(SECPKG_FLAG_NEGOTIABLE);
+ X(SECPKG_FLAG_GSS_COMPATIBLE);
+ X(SECPKG_FLAG_LOGON);
+ X(SECPKG_FLAG_ASCII_BUFFERS);
+ X(SECPKG_FLAG_FRAGMENT);
+ X(SECPKG_FLAG_MUTUAL_AUTH);
+ X(SECPKG_FLAG_DELEGATION);
+ X(SECPKG_FLAG_READONLY_WITH_CHECKSUM);
+ X(SECPKG_FLAG_RESTRICTED_TOKENS);
+ X(SECPKG_FLAG_NEGO_EXTENDER);
+ X(SECPKG_FLAG_NEGOTIABLE2);
+ X(SECPKG_FLAG_APPCONTAINER_PASSTHROUGH);
+ X(SECPKG_FLAG_APPCONTAINER_CHECKS);
+#undef X
trace("Comment: %s\n", pkg_info[i].Comment);
trace("\n");
}
Modified: trunk/rostests/winetests/secur32/ntlm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/secur32/ntlm.c?…
==============================================================================
--- trunk/rostests/winetests/secur32/ntlm.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/secur32/ntlm.c [iso-8859-1] Sun Jul 3 11:50:18 2016
@@ -42,6 +42,8 @@
static SECURITY_STATUS (SEC_ENTRY * pQuerySecurityPackageInfoA)(SEC_CHAR*,
PSecPkgInfoA*);
static SECURITY_STATUS (SEC_ENTRY * pAcquireCredentialsHandleA)(SEC_CHAR*, SEC_CHAR*,
ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID, PCredHandle,
PTimeStamp);
+static SECURITY_STATUS (SEC_ENTRY * pAcquireCredentialsHandleW)(SEC_CHAR*, SEC_WCHAR*,
+ ULONG, PLUID, void*, SEC_GET_KEY_FN, void*, CredHandle*,
TimeStamp*);
static SECURITY_STATUS (SEC_ENTRY * pInitializeSecurityContextA)(PCredHandle,
PCtxtHandle,
SEC_CHAR*, ULONG, ULONG, ULONG, PSecBufferDesc, ULONG,
PCtxtHandle, PSecBufferDesc, PULONG, PTimeStamp);
@@ -149,6 +151,11 @@
{0xc8, 0xf2, 0x39, 0x7f, 0x0c, 0xaf, 0xf5, 0x5d, 0xef, 0x0c,
0x8b, 0x5f, 0x82};
+static char test_user[] = "testuser",
+ workgroup[] = "WORKGROUP",
+ test_pass[] = "testpass",
+ sec_pkg_name[] = "NTLM";
+
static void InitFunctionPtrs(void)
{
secdll = LoadLibraryA("secur32.dll");
@@ -160,6 +167,7 @@
pFreeContextBuffer = (PVOID)GetProcAddress(secdll,
"FreeContextBuffer");
pQuerySecurityPackageInfoA = (PVOID)GetProcAddress(secdll,
"QuerySecurityPackageInfoA");
pAcquireCredentialsHandleA = (PVOID)GetProcAddress(secdll,
"AcquireCredentialsHandleA");
+ pAcquireCredentialsHandleW = (void*)GetProcAddress(secdll,
"AcquireCredentialsHandleW");
pInitializeSecurityContextA = (PVOID)GetProcAddress(secdll,
"InitializeSecurityContextA");
pCompleteAuthToken = (PVOID)GetProcAddress(secdll,
"CompleteAuthToken");
pAcceptSecurityContext = (PVOID)GetProcAddress(secdll,
"AcceptSecurityContext");
@@ -327,7 +335,7 @@
trace("AcquireCredentialsHandle() returned %s\n", getSecError(ret));
}
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
return ret;
@@ -355,7 +363,7 @@
trace("AcquireCredentialsHandle() returned %s\n", getSecError(ret));
}
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
return ret;
@@ -568,10 +576,6 @@
PSecPkgInfoA pkg_info = NULL;
SspiData client;
SEC_WINNT_AUTH_IDENTITY_A id;
- static char sec_pkg_name[] = "NTLM",
- test_user[] = "testuser",
- workgroup[] = "WORKGROUP",
- test_pass[] = "testpass";
ULONG req_attr, ctxt_attr;
TimeStamp ttl;
PBYTE packet;
@@ -793,10 +797,6 @@
SspiData client, server;
SEC_WINNT_AUTH_IDENTITY_A id;
SecPkgContext_Sizes ctxt_sizes;
- static char sec_pkg_name[] = "NTLM",
- test_user[] = "testuser",
- workgroup[] = "WORKGROUP",
- test_pass[] = "testpass";
if(pQuerySecurityPackageInfoA( sec_pkg_name, &pkg_info)!= SEC_E_OK)
{
@@ -930,9 +930,6 @@
SecBuffer data[2], fake_data[2], complex_data[4];
ULONG qop = 0xdeadbeef;
SecPkgContext_Sizes ctxt_sizes;
- static char test_user[] = "testuser",
- workgroup[] = "WORKGROUP",
- test_pass[] = "testpass";
complex_data[1].pvBuffer = complex_data[3].pvBuffer = NULL;
@@ -1186,10 +1183,6 @@
{
CredHandle cred;
TimeStamp ttl;
- static char test_user[] = "testuser",
- workgroup[] = "WORKGROUP",
- test_pass[] = "testpass",
- sec_pkg_name[] = "NTLM";
SECURITY_STATUS ret;
SEC_WINNT_AUTH_IDENTITY_A id;
PSecPkgInfoA pkg_info = NULL;
@@ -1211,21 +1204,21 @@
ret = pAcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND,
NULL, &id, NULL, NULL, &cred, &ttl);
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
pFreeCredentialsHandle(&cred);
id.DomainLength = 0;
ret = pAcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND,
NULL, &id, NULL, NULL, &cred, &ttl);
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
pFreeCredentialsHandle(&cred);
id.Domain = NULL;
ret = pAcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND,
NULL, &id, NULL, NULL, &cred, &ttl);
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
pFreeCredentialsHandle(&cred);
@@ -1235,7 +1228,7 @@
id.User = NULL;
ret = pAcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND,
NULL, &id, NULL, NULL, &cred, &ttl);
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
pFreeCredentialsHandle(&cred);
@@ -1245,18 +1238,104 @@
id.PasswordLength = 0;
ret = pAcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND,
NULL, &id, NULL, NULL, &cred, &ttl);
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
pFreeCredentialsHandle(&cred);
return TRUE;
}
+static void testAcquireCredentialsHandleW(void)
+{
+ CredHandle cred;
+ TimeStamp ttl;
+ static WCHAR sec_pkg_nameW[] = {'N','T','L','M',0 };
+ static WCHAR test_userW[] =
{'t','e','s','t','u','s','e','r',0
};
+ static WCHAR workgroupW[] =
{'W','O','R','K','G','R','O','U','P',0};
+ static WCHAR test_passW[] =
{'t','e','s','t','p','a','s','s',0};
+ SECURITY_STATUS ret;
+ SEC_WINNT_AUTH_IDENTITY_A idA;
+ SEC_WINNT_AUTH_IDENTITY_W id;
+ PSecPkgInfoA pkg_info = NULL;
+
+ if(!pAcquireCredentialsHandleW)
+ {
+ win_skip("AcquireCredentialsHandleW not available\n");
+ return;
+ }
+
+ if(pQuerySecurityPackageInfoA(sec_pkg_name, &pkg_info) != SEC_E_OK)
+ {
+ ok(0, "NTLM package not installed, skipping test\n");
+ return;
+ }
+ pFreeContextBuffer(pkg_info);
+
+ id.User = test_userW;
+ id.UserLength = lstrlenW(test_userW);
+ id.Domain = workgroupW;
+ id.DomainLength = lstrlenW(workgroupW);
+ id.Password = test_passW;
+ id.PasswordLength = lstrlenW(test_passW);
+ id.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
+
+ ret = pAcquireCredentialsHandleW(NULL, sec_pkg_nameW, SECPKG_CRED_OUTBOUND,
+ NULL, &id, NULL, NULL, &cred, &ttl);
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandeW() returned %s\n",
+ getSecError(ret));
+ pFreeCredentialsHandle(&cred);
+
+ id.DomainLength = 0;
+ ret = pAcquireCredentialsHandleW(NULL, sec_pkg_nameW, SECPKG_CRED_OUTBOUND,
+ NULL, &id, NULL, NULL, &cred, &ttl);
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandeW() returned %s\n",
+ getSecError(ret));
+ pFreeCredentialsHandle(&cred);
+
+ id.Domain = NULL;
+ ret = pAcquireCredentialsHandleW(NULL, sec_pkg_nameW, SECPKG_CRED_OUTBOUND,
+ NULL, &id, NULL, NULL, &cred, &ttl);
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandeW() returned %s\n",
+ getSecError(ret));
+ pFreeCredentialsHandle(&cred);
+
+ id.Domain = workgroupW;
+ id.DomainLength = lstrlenW(workgroupW);
+ id.UserLength = 0;
+ id.User = NULL;
+ ret = pAcquireCredentialsHandleW(NULL, sec_pkg_nameW, SECPKG_CRED_OUTBOUND,
+ NULL, &id, NULL, NULL, &cred, &ttl);
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandeW() returned %s\n",
+ getSecError(ret));
+ pFreeCredentialsHandle(&cred);
+
+ id.User = test_userW;
+ id.UserLength = lstrlenW(test_userW);
+ id.Password = test_passW; /* NULL string causes a crash. */
+ id.PasswordLength = 0;
+ ret = pAcquireCredentialsHandleW(NULL, sec_pkg_nameW, SECPKG_CRED_OUTBOUND,
+ NULL, &id, NULL, NULL, &cred, &ttl);
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandeW() returned %s\n",
+ getSecError(ret));
+ pFreeCredentialsHandle(&cred);
+
+ /* Test using the ASCII structure. */
+ idA.User = (unsigned char*) test_user;
+ idA.UserLength = strlen(test_user);
+ idA.Domain = (unsigned char *) workgroup;
+ idA.DomainLength = strlen(workgroup);
+ idA.Password = (unsigned char*) test_pass;
+ idA.PasswordLength = strlen(test_pass);
+ idA.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
+
+ ret = pAcquireCredentialsHandleW(NULL, sec_pkg_nameW, SECPKG_CRED_OUTBOUND,
+ NULL, &idA, NULL, NULL, &cred, &ttl);
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandeW() returned %s\n",
+ getSecError(ret));
+ pFreeCredentialsHandle(&cred);
+}
+
static void test_cred_multiple_use(void)
{
- static char test_user[] = "testuser",
- workgroup[] = "WORKGROUP",
- test_pass[] = "testpass",
- sec_pkg_name[] = "NTLM";
SECURITY_STATUS ret;
SEC_WINNT_AUTH_IDENTITY_A id;
PSecPkgInfoA pkg_info = NULL;
@@ -1289,7 +1368,7 @@
ret = pAcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND,
NULL, &id, NULL, NULL, &cred, &ttl);
- ok(ret == SEC_E_OK, "AcquireCredentialsHande() returned %s\n",
+ ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n",
getSecError(ret));
buffer_desc.ulVersion = SECBUFFER_VERSION;
@@ -1337,7 +1416,7 @@
status = pAcquireCredentialsHandleA(NULL, (SEC_CHAR *)"NTLM",
SECPKG_CRED_OUTBOUND,
NULL, NULL, NULL, NULL, &cred, &ttl);
- ok(status == SEC_E_OK, "AcquireCredentialsHande() failed %s\n",
getSecError(status));
+ ok(status == SEC_E_OK, "AcquireCredentialsHandle() failed %s\n",
getSecError(status));
buffers[0].cbBuffer = info->cbMaxToken;
buffers[0].BufferType = SECBUFFER_TOKEN;
@@ -1373,6 +1452,8 @@
pAcquireCredentialsHandleA && pInitializeSecurityContextA &&
pCompleteAuthToken && pQuerySecurityPackageInfoA)
{
+ testAcquireCredentialsHandleW();
+
if(!testAcquireCredentialsHandle())
goto cleanup;
testInitializeSecurityContextFlags();
Modified: trunk/rostests/winetests/secur32/schannel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/secur32/schanne…
==============================================================================
--- trunk/rostests/winetests/secur32/schannel.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/secur32/schannel.c [iso-8859-1] Sun Jul 3 11:50:18 2016
@@ -640,7 +640,7 @@
cert_cnt++;
}
- ok(cert_cnt == 3, "cert_cnt = %u\n", cert_cnt);
+ ok(cert_cnt == 2 || cert_cnt == 3, "cert_cnt = %u\n", cert_cnt);
ok(incl_remote, "context does not contain cert itself\n");
}
@@ -822,7 +822,6 @@
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;
@@ -832,9 +831,15 @@
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 = pInitializeSecurityContextA(&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 = pInitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR
*)"localhost",
ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM,
0, 0, NULL, 0, &context, &buffers[0], &attrs, NULL);
@@ -907,6 +912,7 @@
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) {