[SECUR32_WINETEST] Sync with Wine Staging 3.3. CORE-14434

This commit is contained in:
Amine Khaldi 2018-04-03 13:45:57 +01:00
parent 6d286a66c3
commit 33b28635b4
4 changed files with 80 additions and 38 deletions

View file

@ -306,12 +306,9 @@ static void test_authentication(void)
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 );

View file

@ -916,12 +916,10 @@ static void testAuth(ULONG data_rep, BOOL fake)
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)
{

View file

@ -17,15 +17,15 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdio.h>
#define SECURITY_WIN32
#include <security.h>
#include <schannel.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include "wine/test.h"
@ -772,7 +772,6 @@ 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;
@ -782,9 +781,15 @@ 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);
@ -859,6 +864,7 @@ 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) {

View file

@ -22,10 +22,13 @@
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <wincred.h>
#include <rpc.h>
#include <rpcdce.h>
#define SECURITY_WIN32
#include <security.h>
#include <schannel.h>
#include <wincred.h>
#include <winsock2.h>
#include "wine/test.h"
@ -65,20 +68,40 @@ static void testGetComputerObjectNameA(void)
UINT i;
for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) {
size = 0;
SetLastError(0xdeadbeef);
rc = pGetComputerObjectNameA(formats[i], NULL, &size);
ok(!rc, "GetComputerObjectName(%u) should fail\n", formats[i]);
switch (formats[i])
{
case NameUnknown:
ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError());
break;
default:
ok(GetLastError() == ERROR_NONE_MAPPED ||
GetLastError() == ERROR_NO_SUCH_USER ||
GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO ||
GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"%u: got %u\n", formats[i], GetLastError());
break;
}
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) continue;
size = sizeof(name);
ZeroMemory(name, sizeof(name));
SetLastError(0xdeadbeef);
rc = pGetComputerObjectNameA(formats[i], name, &size);
ok(rc || ((formats[i] == NameUnknown) &&
(GetLastError() == ERROR_INVALID_PARAMETER)) ||
(GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO) ||
(GetLastError() == ERROR_NO_SUCH_DOMAIN) ||
(GetLastError() == ERROR_NO_SUCH_USER) ||
(GetLastError() == ERROR_NONE_MAPPED) ||
(GetLastError() == ERROR_ACCESS_DENIED),
"GetComputerObjectNameA(%d) failed: %d\n",
formats[i], GetLastError());
if (rc)
trace("GetComputerObjectNameA() returned %s\n", name);
switch (formats[i])
{
case NameUnknown:
ok(!rc, "GetComputerObjectName(%u) should fail\n", formats[i]);
ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError());
break;
default:
ok(rc, "GetComputerObjectName(%u) error %u\n", formats[i], GetLastError());
trace("GetComputerObjectName(%u) returned %s\n", formats[i], name);
break;
}
}
}
@ -90,22 +113,40 @@ static void testGetComputerObjectNameW(void)
UINT i;
for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) {
size = 0;
SetLastError(0xdeadbeef);
rc = pGetComputerObjectNameW(formats[i], NULL, &size);
ok(!rc || broken(rc) /* win10 */, "GetComputerObjectName(%u) should fail\n", formats[i]);
switch (formats[i])
{
case NameUnknown:
ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError());
break;
default:
ok(GetLastError() == ERROR_NONE_MAPPED ||
GetLastError() == ERROR_NO_SUCH_USER ||
GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO ||
GetLastError() == WSAHOST_NOT_FOUND ||
GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"%u: got %u\n", formats[i], GetLastError());
break;
}
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) continue;
size = sizeof(nameW)/sizeof(nameW[0]);
ZeroMemory(nameW, sizeof(nameW));
SetLastError(0xdeadbeef);
rc = pGetComputerObjectNameW(formats[i], nameW, &size);
ok(rc || ((formats[i] == NameUnknown) &&
(GetLastError() == ERROR_INVALID_PARAMETER)) ||
(GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO) ||
(GetLastError() == ERROR_NO_SUCH_DOMAIN) ||
(GetLastError() == ERROR_NO_SUCH_USER) ||
(GetLastError() == ERROR_NONE_MAPPED) ||
(GetLastError() == ERROR_ACCESS_DENIED),
"GetComputerObjectNameW(%d) failed: %d\n",
formats[i], GetLastError());
if (rc) {
char name[256];
WideCharToMultiByte( CP_ACP, 0, nameW, -1, name, sizeof(name), NULL, NULL );
trace("GetComputerObjectNameW() returned %s\n", name);
switch (formats[i])
{
case NameUnknown:
ok(!rc, "GetComputerObjectName(%u) should fail\n", formats[i]);
ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError());
break;
default:
ok(rc, "GetComputerObjectName(%u) error %u\n", formats[i], GetLastError());
trace("GetComputerObjectName(%u) returned %s\n", formats[i], wine_dbgstr_w(nameW));
break;
}
}
}