Commit a92db992 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

secur32/tests: Enable compilation with long types.

parent ff63f816
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = secur32.dll
IMPORTS = secur32 crypt32 advapi32 ws2_32
......
......@@ -98,7 +98,7 @@ static const char* getSecError(SECURITY_STATUS status)
_SEC_ERR(SEC_E_NO_CREDENTIALS);
_SEC_ERR(SEC_E_OUT_OF_SEQUENCE);
default:
sprintf(buf, "%08x\n", status);
sprintf(buf, "%08lx\n", status);
return buf;
}
#undef _SEC_ERR
......@@ -140,27 +140,27 @@ static void testEnumerateSecurityPackages(void)
sec_status = pEnumerateSecurityPackagesA(&num_packages, &pkg_info);
ok(sec_status == SEC_E_OK,
"EnumerateSecurityPackages() should return %d, not %08x\n",
"EnumerateSecurityPackages() should return %ld, not %08lx\n",
SEC_E_OK, sec_status);
if (num_packages == 0)
{
todo_wine
ok(num_packages > 0, "Number of sec packages should be > 0 ,but is %d\n",
ok(num_packages > 0, "Number of sec packages should be > 0 ,but is %ld\n",
num_packages);
skip("no sec packages to check\n");
return;
}
else
ok(num_packages > 0, "Number of sec packages should be > 0 ,but is %d\n",
ok(num_packages > 0, "Number of sec packages should be > 0 ,but is %ld\n",
num_packages);
ok(pkg_info != NULL,
"pkg_info should not be NULL after EnumerateSecurityPackages\n");
trace("Number of packages: %d\n", num_packages);
trace("Number of packages: %ld\n", num_packages);
for(i = 0; i < num_packages; ++i){
trace("%d: Package \"%s\"\n", i, pkg_info[i].Name);
trace("%ld: Package \"%s\"\n", i, pkg_info[i].Name);
trace("Supported flags:\n");
#define X(flag) \
if(pkg_info[i].fCapabilities & flag) \
......
......@@ -120,14 +120,14 @@ static SECURITY_STATUS setup_client( struct sspi_data *data, SEC_CHAR *provider
trace( "setting up client\n" );
ret = QuerySecurityPackageInfoA( provider, &info );
ok( ret == SEC_E_OK, "QuerySecurityPackageInfo returned %08x\n", ret );
ok( ret == SEC_E_OK, "QuerySecurityPackageInfo returned %08lx\n", ret );
setup_buffers( data, info );
FreeContextBuffer( info );
ret = AcquireCredentialsHandleA( NULL, provider, SECPKG_CRED_OUTBOUND, NULL,
data->id, NULL, NULL, &data->cred, &ttl );
ok( ret == SEC_E_OK, "AcquireCredentialsHandleA returned %08x\n", ret );
ok( ret == SEC_E_OK, "AcquireCredentialsHandleA returned %08lx\n", ret );
return ret;
}
......@@ -140,14 +140,14 @@ static SECURITY_STATUS setup_server( struct sspi_data *data, SEC_CHAR *provider
trace( "setting up server\n" );
ret = QuerySecurityPackageInfoA( provider, &info );
ok( ret == SEC_E_OK, "QuerySecurityPackageInfo returned %08x\n", ret );
ok( ret == SEC_E_OK, "QuerySecurityPackageInfo returned %08lx\n", ret );
setup_buffers( data, info );
FreeContextBuffer( info );
ret = AcquireCredentialsHandleA( NULL, provider, SECPKG_CRED_INBOUND, NULL,
NULL, NULL, NULL, &data->cred, &ttl );
ok( ret == SEC_E_OK, "AcquireCredentialsHandleA returned %08x\n", ret );
ok( ret == SEC_E_OK, "AcquireCredentialsHandleA returned %08lx\n", ret );
return ret;
}
......@@ -174,7 +174,7 @@ static SECURITY_STATUS run_client( struct sspi_data *data, BOOL first )
ret = SEC_E_OK;
}
ok( data->out_buf->pBuffers[0].BufferType == SECBUFFER_TOKEN,
"buffer type changed from SECBUFFER_TOKEN to %u\n", data->out_buf->pBuffers[0].BufferType );
"buffer type changed from SECBUFFER_TOKEN to %lu\n", data->out_buf->pBuffers[0].BufferType );
ok( data->out_buf->pBuffers[0].cbBuffer < data->max_token,
"InitializeSecurityContext didn't change buffer size\n" );
return ret;
......@@ -237,12 +237,12 @@ static void test_authentication(void)
client.id = &id;
if ((status = setup_client( &client, (SEC_CHAR *)"Negotiate" )))
{
skip( "setup_client returned %08x, skipping test\n", status );
skip( "setup_client returned %08lx, skipping test\n", status );
return;
}
if ((status = setup_server( &server, (SEC_CHAR *)"Negotiate" )))
{
skip( "setup_server returned %08x, skipping test\n", status );
skip( "setup_server returned %08lx, skipping test\n", status );
FreeCredentialsHandle( &client.cred );
return;
}
......@@ -251,14 +251,14 @@ static void test_authentication(void)
{
status_c = run_client( &client, first );
ok( status_c == SEC_E_OK || status_c == SEC_I_CONTINUE_NEEDED,
"client returned %08x, more tests will fail\n", status_c );
"client returned %08lx, more tests will fail\n", status_c );
communicate( &client, &server );
status_s = run_server( &server, first );
ok( status_s == SEC_E_OK || status_s == SEC_I_CONTINUE_NEEDED ||
status_s == SEC_E_LOGON_DENIED,
"server returned %08x, more tests will fail\n", status_s );
"server returned %08lx, more tests will fail\n", status_s );
communicate( &server, &client );
trace( "looping\n");
......@@ -275,19 +275,19 @@ static void test_authentication(void)
sizes.cbSecurityTrailer = 0xdeadbeef;
sizes.cbBlockSize = 0xdeadbeef;
status_c = QueryContextAttributesA( &client.ctxt, SECPKG_ATTR_SIZES, &sizes );
ok( status_c == SEC_E_OK, "pQueryContextAttributesA returned %08x\n", status_c );
ok( status_c == SEC_E_OK, "pQueryContextAttributesA returned %08lx\n", status_c );
ok( sizes.cbMaxToken == 2888 || sizes.cbMaxToken == 1904,
"expected 2888 or 1904, got %u\n", sizes.cbMaxToken );
ok( sizes.cbMaxSignature == 16, "expected 16, got %u\n", sizes.cbMaxSignature );
ok( sizes.cbSecurityTrailer == 16, "expected 16, got %u\n", sizes.cbSecurityTrailer );
ok( !sizes.cbBlockSize, "expected 0, got %u\n", sizes.cbBlockSize );
"expected 2888 or 1904, got %lu\n", sizes.cbMaxToken );
ok( sizes.cbMaxSignature == 16, "expected 16, got %lu\n", sizes.cbMaxSignature );
ok( sizes.cbSecurityTrailer == 16, "expected 16, got %lu\n", sizes.cbSecurityTrailer );
ok( !sizes.cbBlockSize, "expected 0, got %lu\n", sizes.cbBlockSize );
memset( &info, 0, sizeof(info) );
status_c = QueryContextAttributesA( &client.ctxt, SECPKG_ATTR_NEGOTIATION_INFO, &info );
ok( status_c == SEC_E_OK, "QueryContextAttributesA returned %08x\n", status_c );
ok( status_c == SEC_E_OK, "QueryContextAttributesA returned %08lx\n", status_c );
pi = info.PackageInfo;
ok( info.NegotiationState == SECPKG_NEGOTIATION_COMPLETE, "got %u\n", info.NegotiationState );
ok( info.NegotiationState == SECPKG_NEGOTIATION_COMPLETE, "got %lu\n", info.NegotiationState );
ok( pi != NULL, "expected non-NULL PackageInfo\n" );
if (pi)
{
......@@ -301,7 +301,7 @@ static void test_authentication(void)
pi->fCapabilities == (NTLM_BASE_CAPS|SECPKG_FLAG_RESTRICTED_TOKENS|SECPKG_FLAG_APPLY_LOOPBACK) ||
pi->fCapabilities == (NTLM_BASE_CAPS|SECPKG_FLAG_RESTRICTED_TOKENS|SECPKG_FLAG_APPLY_LOOPBACK|
SECPKG_FLAG_APPCONTAINER_CHECKS),
"got %08x\n", pi->fCapabilities );
"got %08lx\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 );
......@@ -314,7 +314,7 @@ static void test_authentication(void)
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 );
ok( status == SEC_E_OK, "FreeContextBuffer error %#lx\n", status );
}
done:
......@@ -324,25 +324,25 @@ done:
if (client.ctxt.dwLower || client.ctxt.dwUpper)
{
status_c = DeleteSecurityContext( &client.ctxt );
ok( status_c == SEC_E_OK, "DeleteSecurityContext returned %08x\n", status_c );
ok( status_c == SEC_E_OK, "DeleteSecurityContext returned %08lx\n", status_c );
}
if (server.ctxt.dwLower || server.ctxt.dwUpper)
{
status_s = DeleteSecurityContext( &server.ctxt );
ok( status_s == SEC_E_OK, "DeleteSecurityContext returned %08x\n", status_s );
ok( status_s == SEC_E_OK, "DeleteSecurityContext returned %08lx\n", status_s );
}
if (client.cred.dwLower || client.cred.dwUpper)
{
status_c = FreeCredentialsHandle( &client.cred );
ok( status_c == SEC_E_OK, "FreeCredentialsHandle returned %08x\n", status_c );
ok( status_c == SEC_E_OK, "FreeCredentialsHandle returned %08lx\n", status_c );
}
if (server.cred.dwLower || server.cred.dwUpper)
{
status_s = FreeCredentialsHandle(&server.cred);
ok( status_s == SEC_E_OK, "FreeCredentialsHandle returned %08x\n", status_s );
ok( status_s == SEC_E_OK, "FreeCredentialsHandle returned %08lx\n", status_s );
}
}
......@@ -360,7 +360,7 @@ START_TEST(negotiate)
info->fCapabilities == (NEGOTIATE_BASE_CAPS|SECPKG_FLAG_RESTRICTED_TOKENS) ||
info->fCapabilities == (NEGOTIATE_BASE_CAPS|SECPKG_FLAG_RESTRICTED_TOKENS|
SECPKG_FLAG_APPCONTAINER_CHECKS),
"got %08x\n", info->fCapabilities );
"got %08lx\n", info->fCapabilities );
ok( info->wVersion == 1, "got %u\n", info->wVersion );
ok( info->wRPCID == RPC_C_AUTHN_GSS_NEGOTIATE, "got %u\n", info->wRPCID );
ok( !lstrcmpA( info->Name, "Negotiate" ), "got %s\n", info->Name );
......
......@@ -233,7 +233,7 @@ static const char* getSecError(SECURITY_STATUS status)
_SEC_ERR(SEC_E_OUT_OF_SEQUENCE);
_SEC_ERR(SEC_E_MESSAGE_ALTERED);
default:
sprintf(buf, "%08x\n", status);
sprintf(buf, "%08lx\n", status);
return buf;
}
#undef _SEC_ERR
......@@ -476,7 +476,7 @@ static SECURITY_STATUS runClient(SspiData *sspi_data, BOOL first, ULONG data_rep
ok(ret == SEC_E_BUFFER_TOO_SMALL, "expected SEC_E_BUFFER_TOO_SMALL, got %s\n", getSecError(ret));
ok(out_buf->pBuffers[0].cbBuffer == 0,
"InitializeSecurityContext set buffer size to %u\n", out_buf->pBuffers[0].cbBuffer);
"InitializeSecurityContext set buffer size to %lu\n", out_buf->pBuffers[0].cbBuffer);
out_buf->pBuffers[0].cbBuffer = sspi_data->max_token;
out_buf->pBuffers[0].BufferType = SECBUFFER_DATA;
......@@ -505,9 +505,9 @@ static SECURITY_STATUS runClient(SspiData *sspi_data, BOOL first, ULONG data_rep
}
ok(out_buf->pBuffers[0].BufferType == SECBUFFER_TOKEN,
"buffer type was changed from SECBUFFER_TOKEN to %d\n", out_buf->pBuffers[0].BufferType);
"buffer type was changed from SECBUFFER_TOKEN to %ld\n", out_buf->pBuffers[0].BufferType);
ok(out_buf->pBuffers[0].cbBuffer < sspi_data->max_token,
"InitializeSecurityContext set buffer size to %u\n", out_buf->pBuffers[0].cbBuffer);
"InitializeSecurityContext set buffer size to %lu\n", out_buf->pBuffers[0].cbBuffer);
return ret;
}
......@@ -902,24 +902,24 @@ static void testAuth(ULONG data_rep, BOOL fake)
"pQueryContextAttributesA(SECPKG_ATTR_SIZES) returned %s\n",
getSecError(sec_status));
ok((ctxt_sizes.cbMaxToken == 1904) || (ctxt_sizes.cbMaxToken == 2888),
"cbMaxToken should be 1904 or 2888 but is %u\n",
"cbMaxToken should be 1904 or 2888 but is %lu\n",
ctxt_sizes.cbMaxToken);
ok(ctxt_sizes.cbMaxSignature == 16,
"cbMaxSignature should be 16 but is %u\n",
"cbMaxSignature should be 16 but is %lu\n",
ctxt_sizes.cbMaxSignature);
ok(ctxt_sizes.cbSecurityTrailer == 16,
"cbSecurityTrailer should be 16 but is %u\n",
"cbSecurityTrailer should be 16 but is %lu\n",
ctxt_sizes.cbSecurityTrailer);
ok(ctxt_sizes.cbBlockSize == 0,
"cbBlockSize should be 0 but is %u\n",
"cbBlockSize should be 0 but is %lu\n",
ctxt_sizes.cbBlockSize);
memset(&info, 0, sizeof(info));
sec_status = QueryContextAttributesA(&client.ctxt, SECPKG_ATTR_NEGOTIATION_INFO, &info);
ok(sec_status == SEC_E_OK, "QueryContextAttributesA returned %08x\n", sec_status);
ok(sec_status == SEC_E_OK, "QueryContextAttributesA returned %08lx\n", sec_status);
pi = info.PackageInfo;
ok(info.NegotiationState == SECPKG_NEGOTIATION_COMPLETE, "got %u\n", info.NegotiationState);
ok(info.NegotiationState == SECPKG_NEGOTIATION_COMPLETE, "got %lu\n", info.NegotiationState);
ok(pi != NULL, "expected non-NULL PackageInfo\n");
if (pi)
{
......@@ -933,7 +933,7 @@ static void testAuth(ULONG data_rep, BOOL fake)
pi->fCapabilities == (NTLM_BASE_CAPS|SECPKG_FLAG_RESTRICTED_TOKENS|SECPKG_FLAG_APPLY_LOOPBACK) ||
pi->fCapabilities == (NTLM_BASE_CAPS|SECPKG_FLAG_RESTRICTED_TOKENS|SECPKG_FLAG_APPLY_LOOPBACK|
SECPKG_FLAG_APPCONTAINER_CHECKS),
"got %08x\n", pi->fCapabilities);
"got %08lx\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);
......@@ -946,7 +946,7 @@ static void testAuth(ULONG data_rep, BOOL fake)
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);
ok(sec_status == SEC_E_OK, "FreeContextBuffer error %#lx\n", sec_status);
}
tAuthend:
......@@ -1108,13 +1108,13 @@ static void testSignSeal(void)
ok(sec_status == SEC_E_MESSAGE_ALTERED,
"VerifySignature returned %s, not SEC_E_MESSAGE_ALTERED.\n",
getSecError(sec_status));
ok(qop == 0xdeadbeef, "qop changed to %u\n", qop);
ok(qop == 0xdeadbeef, "qop changed to %lu\n", qop);
memcpy(data[0].pvBuffer, message_signature, data[0].cbBuffer);
sec_status = pVerifySignature(&client.ctxt, &crypt, 0, &qop);
ok(sec_status == SEC_E_OK, "VerifySignature returned %s, not SEC_E_OK.\n",
getSecError(sec_status));
ok(qop == 0xdeadbeef, "qop changed to %u\n", qop);
ok(qop == 0xdeadbeef, "qop changed to %lu\n", qop);
sec_status = pEncryptMessage(&client.ctxt, 0, &crypt, 0);
if (sec_status == SEC_E_UNSUPPORTED_FUNCTION)
......@@ -1161,7 +1161,7 @@ static void testSignSeal(void)
ok(!memcmp(crypt.pBuffers[1].pvBuffer, message_binary,
crypt.pBuffers[1].cbBuffer),
"Failed to decrypt message correctly.\n");
ok(qop == 0xdeadbeef, "qop changed to %u\n", qop);
ok(qop == 0xdeadbeef, "qop changed to %lu\n", qop);
}
else trace( "A different session key is being used\n" );
......@@ -1199,7 +1199,7 @@ static void testSignSeal(void)
sec_status = pVerifySignature(&client.ctxt, &crypt, 0, &qop);
ok(sec_status == SEC_E_OK, "VerifySignature returned %s, not SEC_E_OK\n",
getSecError(sec_status));
ok(qop == 0xdeadbeef, "qop changed to %u\n", qop);
ok(qop == 0xdeadbeef, "qop changed to %lu\n", qop);
sec_status = pEncryptMessage(&client.ctxt, 0, &crypt, 0);
ok(sec_status == SEC_E_OK, "EncryptMessage returned %s, not SEC_E_OK.\n",
......@@ -1231,7 +1231,7 @@ static void testSignSeal(void)
sec_status = pDecryptMessage(&client.ctxt, &crypt, 0, &qop);
ok(sec_status == SEC_E_OK, "DecryptMessage returned %s, not SEC_E_OK.\n",
getSecError(sec_status));
ok(qop == 0xdeadbeef, "qop changed to %u\n", qop);
ok(qop == 0xdeadbeef, "qop changed to %lu\n", qop);
end:
......@@ -1444,19 +1444,19 @@ static void test_cred_multiple_use(void)
ret = pInitializeSecurityContextA(&cred, NULL, NULL, ISC_REQ_CONNECTION,
0, SECURITY_NETWORK_DREP, NULL, 0, &ctxt1, &buffer_desc,
&ctxt_attr, &ttl);
ok(ret == SEC_I_CONTINUE_NEEDED, "InitializeSecurityContextA failed with error 0x%x\n", ret);
ok(ret == SEC_I_CONTINUE_NEEDED, "InitializeSecurityContextA failed with error 0x%lx\n", ret);
ret = pInitializeSecurityContextA(&cred, NULL, NULL, ISC_REQ_CONNECTION,
0, SECURITY_NETWORK_DREP, NULL, 0, &ctxt2, &buffer_desc,
&ctxt_attr, &ttl);
ok(ret == SEC_I_CONTINUE_NEEDED, "Second InitializeSecurityContextA on cred handle failed with error 0x%x\n", ret);
ok(ret == SEC_I_CONTINUE_NEEDED, "Second InitializeSecurityContextA on cred handle failed with error 0x%lx\n", ret);
ret = pDeleteSecurityContext(&ctxt1);
ok(ret == SEC_E_OK, "DeleteSecurityContext failed with error 0x%x\n", ret);
ok(ret == SEC_E_OK, "DeleteSecurityContext failed with error 0x%lx\n", ret);
ret = pDeleteSecurityContext(&ctxt2);
ok(ret == SEC_E_OK, "DeleteSecurityContext failed with error 0x%x\n", ret);
ok(ret == SEC_E_OK, "DeleteSecurityContext failed with error 0x%lx\n", ret);
ret = pFreeCredentialsHandle(&cred);
ok(ret == SEC_E_OK, "FreeCredentialsHandle failed with error 0x%x\n", ret);
ok(ret == SEC_E_OK, "FreeCredentialsHandle failed with error 0x%lx\n", ret);
HeapFree(GetProcessHeap(), 0, buffers[0].pvBuffer);
}
......@@ -1494,7 +1494,7 @@ static void test_null_auth_data(void)
size = sizeof(user);
ret = pGetUserNameExA(NameSamCompatible, user, &size);
ok(ret, "GetUserNameExA failed %u\n", GetLastError());
ok(ret, "GetUserNameExA failed %lu\n", GetLastError());
status = pInitializeSecurityContextA(&cred, NULL, (SEC_CHAR *)user,
ISC_REQ_CONNECTION, 0, SECURITY_NETWORK_DREP,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment