mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 19:26:32 +00:00
[SECUR32_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866
svn path=/trunk/; revision=72256
This commit is contained in:
@@ -9,5 +9,5 @@ list(APPEND SOURCE
|
||||
|
||||
add_executable(secur32_winetest ${SOURCE})
|
||||
set_module_type(secur32_winetest win32cui)
|
||||
add_importlibs(secur32_winetest advapi32 ws2_32 msvcrt kernel32)
|
||||
add_importlibs(secur32_winetest advapi32 ws2_32 crypt32 secur32 msvcrt kernel32)
|
||||
add_cd_file(TARGET secur32_winetest DESTINATION reactos/bin FOR all)
|
||||
|
||||
@@ -31,45 +31,6 @@
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static HMODULE hsecur32;
|
||||
static SECURITY_STATUS (SEC_ENTRY * pAcceptSecurityContext)(PCredHandle, PCtxtHandle,
|
||||
PSecBufferDesc, ULONG, ULONG, PCtxtHandle, PSecBufferDesc, PULONG, PTimeStamp);
|
||||
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 * pCompleteAuthToken)(PCtxtHandle, PSecBufferDesc);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pDecryptMessage)(PCtxtHandle, PSecBufferDesc, ULONG, PULONG);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pDeleteSecurityContext)(PCtxtHandle);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pEncryptMessage)(PCtxtHandle, ULONG, PSecBufferDesc, ULONG);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pFreeContextBuffer)(PVOID);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pFreeCredentialsHandle)(PCredHandle);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pInitializeSecurityContextA)(PCredHandle, PCtxtHandle,
|
||||
SEC_CHAR *, ULONG, ULONG, ULONG, PSecBufferDesc, ULONG, PCtxtHandle, PSecBufferDesc,
|
||||
PULONG, PTimeStamp);
|
||||
static PSecurityFunctionTableA (SEC_ENTRY * pInitSecurityInterfaceA)(void);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pMakeSignature)(PCtxtHandle, ULONG, PSecBufferDesc, ULONG);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pQueryContextAttributesA)(PCtxtHandle, ULONG, PVOID);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pQuerySecurityPackageInfoA)(SEC_CHAR *, PSecPkgInfoA *);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pVerifySignature)(PCtxtHandle, PSecBufferDesc, ULONG, PULONG);
|
||||
|
||||
static void init_function_ptrs(void)
|
||||
{
|
||||
if (!(hsecur32 = LoadLibraryA("secur32.dll"))) return;
|
||||
pAcceptSecurityContext = (void *)GetProcAddress(hsecur32, "AcceptSecurityContext");
|
||||
pAcquireCredentialsHandleA = (void *)GetProcAddress(hsecur32, "AcquireCredentialsHandleA");
|
||||
pCompleteAuthToken = (void *)GetProcAddress(hsecur32, "CompleteAuthToken");
|
||||
pDecryptMessage = (void *)GetProcAddress(hsecur32, "DecryptMessage");
|
||||
pDeleteSecurityContext = (void *)GetProcAddress(hsecur32, "DeleteSecurityContext");
|
||||
pEncryptMessage = (void *)GetProcAddress(hsecur32, "EncryptMessage");
|
||||
pFreeContextBuffer = (void *)GetProcAddress(hsecur32, "FreeContextBuffer");
|
||||
pFreeCredentialsHandle = (void *)GetProcAddress(hsecur32, "FreeCredentialsHandle");
|
||||
pInitializeSecurityContextA = (void *)GetProcAddress(hsecur32, "InitializeSecurityContextA");
|
||||
pInitSecurityInterfaceA = (void *)GetProcAddress(hsecur32, "InitSecurityInterfaceA");
|
||||
pMakeSignature = (void *)GetProcAddress(hsecur32, "MakeSignature");
|
||||
pQueryContextAttributesA = (void *)GetProcAddress(hsecur32, "QueryContextAttributesA");
|
||||
pQuerySecurityPackageInfoA = (void *)GetProcAddress(hsecur32, "QuerySecurityPackageInfoA");
|
||||
pVerifySignature = (void *)GetProcAddress(hsecur32, "VerifySignature");
|
||||
}
|
||||
|
||||
#define NEGOTIATE_BASE_CAPS ( \
|
||||
SECPKG_FLAG_INTEGRITY | \
|
||||
SECPKG_FLAG_PRIVACY | \
|
||||
@@ -158,14 +119,14 @@ static SECURITY_STATUS setup_client( struct sspi_data *data, SEC_CHAR *provider
|
||||
|
||||
trace( "setting up client\n" );
|
||||
|
||||
ret = pQuerySecurityPackageInfoA( provider, &info );
|
||||
ret = QuerySecurityPackageInfoA( provider, &info );
|
||||
ok( ret == SEC_E_OK, "QuerySecurityPackageInfo returned %08x\n", ret );
|
||||
|
||||
setup_buffers( data, info );
|
||||
pFreeContextBuffer( info );
|
||||
FreeContextBuffer( info );
|
||||
|
||||
ret = pAcquireCredentialsHandleA( NULL, provider, SECPKG_CRED_OUTBOUND, NULL,
|
||||
data->id, NULL, NULL, &data->cred, &ttl );
|
||||
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 );
|
||||
return ret;
|
||||
}
|
||||
@@ -178,14 +139,14 @@ static SECURITY_STATUS setup_server( struct sspi_data *data, SEC_CHAR *provider
|
||||
|
||||
trace( "setting up server\n" );
|
||||
|
||||
ret = pQuerySecurityPackageInfoA( provider, &info );
|
||||
ret = QuerySecurityPackageInfoA( provider, &info );
|
||||
ok( ret == SEC_E_OK, "QuerySecurityPackageInfo returned %08x\n", ret );
|
||||
|
||||
setup_buffers( data, info );
|
||||
pFreeContextBuffer( info );
|
||||
FreeContextBuffer( info );
|
||||
|
||||
ret = pAcquireCredentialsHandleA( NULL, provider, SECPKG_CRED_INBOUND, NULL,
|
||||
NULL, NULL, NULL, &data->cred, &ttl );
|
||||
ret = AcquireCredentialsHandleA( NULL, provider, SECPKG_CRED_INBOUND, NULL,
|
||||
NULL, NULL, NULL, &data->cred, &ttl );
|
||||
ok( ret == SEC_E_OK, "AcquireCredentialsHandleA returned %08x\n", ret );
|
||||
return ret;
|
||||
}
|
||||
@@ -201,12 +162,12 @@ static SECURITY_STATUS run_client( struct sspi_data *data, BOOL first )
|
||||
data->out_buf->pBuffers[0].cbBuffer = data->max_token;
|
||||
data->out_buf->pBuffers[0].BufferType = SECBUFFER_TOKEN;
|
||||
|
||||
ret = pInitializeSecurityContextA( first ? &data->cred : NULL, first ? NULL : &data->ctxt,
|
||||
NULL, 0, 0, SECURITY_NETWORK_DREP, first ? NULL : data->in_buf,
|
||||
0, &data->ctxt, data->out_buf, &attr, &ttl );
|
||||
ret = InitializeSecurityContextA( first ? &data->cred : NULL, first ? NULL : &data->ctxt,
|
||||
NULL, 0, 0, SECURITY_NETWORK_DREP, first ? NULL : data->in_buf,
|
||||
0, &data->ctxt, data->out_buf, &attr, &ttl );
|
||||
if (ret == SEC_I_COMPLETE_AND_CONTINUE || ret == SEC_I_COMPLETE_NEEDED)
|
||||
{
|
||||
pCompleteAuthToken( &data->ctxt, data->out_buf );
|
||||
CompleteAuthToken( &data->ctxt, data->out_buf );
|
||||
if (ret == SEC_I_COMPLETE_AND_CONTINUE)
|
||||
ret = SEC_I_CONTINUE_NEEDED;
|
||||
else if (ret == SEC_I_COMPLETE_NEEDED)
|
||||
@@ -227,12 +188,12 @@ static SECURITY_STATUS run_server( struct sspi_data *data, BOOL first )
|
||||
|
||||
trace( "running server for the %s time\n", first ? "first" : "second" );
|
||||
|
||||
ret = pAcceptSecurityContext( &data->cred, first ? NULL : &data->ctxt,
|
||||
data->in_buf, 0, SECURITY_NETWORK_DREP,
|
||||
&data->ctxt, data->out_buf, &attr, &ttl );
|
||||
ret = AcceptSecurityContext( &data->cred, first ? NULL : &data->ctxt,
|
||||
data->in_buf, 0, SECURITY_NETWORK_DREP,
|
||||
&data->ctxt, data->out_buf, &attr, &ttl );
|
||||
if (ret == SEC_I_COMPLETE_AND_CONTINUE || ret == SEC_I_COMPLETE_NEEDED)
|
||||
{
|
||||
pCompleteAuthToken( &data->ctxt, data->out_buf );
|
||||
CompleteAuthToken( &data->ctxt, data->out_buf );
|
||||
if (ret == SEC_I_COMPLETE_AND_CONTINUE)
|
||||
ret = SEC_I_CONTINUE_NEEDED;
|
||||
else if (ret == SEC_I_COMPLETE_NEEDED)
|
||||
@@ -282,7 +243,7 @@ static void test_authentication(void)
|
||||
if ((status = setup_server( &server, (SEC_CHAR *)"Negotiate" )))
|
||||
{
|
||||
skip( "setup_server returned %08x, skipping test\n", status );
|
||||
pFreeCredentialsHandle( &client.cred );
|
||||
FreeCredentialsHandle( &client.cred );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -313,7 +274,7 @@ static void test_authentication(void)
|
||||
sizes.cbMaxSignature = 0xdeadbeef;
|
||||
sizes.cbSecurityTrailer = 0xdeadbeef;
|
||||
sizes.cbBlockSize = 0xdeadbeef;
|
||||
status_c = pQueryContextAttributesA( &client.ctxt, SECPKG_ATTR_SIZES, &sizes );
|
||||
status_c = QueryContextAttributesA( &client.ctxt, SECPKG_ATTR_SIZES, &sizes );
|
||||
ok( status_c == SEC_E_OK, "pQueryContextAttributesA returned %08x\n", status_c );
|
||||
ok( sizes.cbMaxToken == 2888 || sizes.cbMaxToken == 1904,
|
||||
"expected 2888 or 1904, got %u\n", sizes.cbMaxToken );
|
||||
@@ -322,7 +283,7 @@ static void test_authentication(void)
|
||||
ok( !sizes.cbBlockSize, "expected 0, got %u\n", sizes.cbBlockSize );
|
||||
|
||||
memset( &info, 0, sizeof(info) );
|
||||
status_c = pQueryContextAttributesA( &client.ctxt, SECPKG_ATTR_NEGOTIATION_INFO, &info );
|
||||
status_c = QueryContextAttributesA( &client.ctxt, SECPKG_ATTR_NEGOTIATION_INFO, &info );
|
||||
ok( status_c == SEC_E_OK, "pQueryContextAttributesA returned %08x\n", status_c );
|
||||
|
||||
pi = info.PackageInfo;
|
||||
@@ -347,25 +308,25 @@ done:
|
||||
|
||||
if (client.ctxt.dwLower || client.ctxt.dwUpper)
|
||||
{
|
||||
status_c = pDeleteSecurityContext( &client.ctxt );
|
||||
status_c = DeleteSecurityContext( &client.ctxt );
|
||||
ok( status_c == SEC_E_OK, "DeleteSecurityContext returned %08x\n", status_c );
|
||||
}
|
||||
|
||||
if (server.ctxt.dwLower || server.ctxt.dwUpper)
|
||||
{
|
||||
status_s = pDeleteSecurityContext( &server.ctxt );
|
||||
status_s = DeleteSecurityContext( &server.ctxt );
|
||||
ok( status_s == SEC_E_OK, "DeleteSecurityContext returned %08x\n", status_s );
|
||||
}
|
||||
|
||||
if (client.cred.dwLower || client.cred.dwUpper)
|
||||
{
|
||||
status_c = pFreeCredentialsHandle( &client.cred );
|
||||
status_c = FreeCredentialsHandle( &client.cred );
|
||||
ok( status_c == SEC_E_OK, "FreeCredentialsHandle returned %08x\n", status_c );
|
||||
}
|
||||
|
||||
if (server.cred.dwLower || server.cred.dwUpper)
|
||||
{
|
||||
status_s = pFreeCredentialsHandle(&server.cred);
|
||||
status_s = FreeCredentialsHandle(&server.cred);
|
||||
ok( status_s == SEC_E_OK, "FreeCredentialsHandle returned %08x\n", status_s );
|
||||
}
|
||||
}
|
||||
@@ -374,15 +335,7 @@ START_TEST(negotiate)
|
||||
{
|
||||
SecPkgInfoA *info;
|
||||
|
||||
init_function_ptrs();
|
||||
|
||||
if (!pFreeCredentialsHandle || !pAcquireCredentialsHandleA || !pQuerySecurityPackageInfoA ||
|
||||
!pFreeContextBuffer)
|
||||
{
|
||||
win_skip("functions are not available\n");
|
||||
return;
|
||||
}
|
||||
if (pQuerySecurityPackageInfoA( (SEC_CHAR *)"Negotiate", &info ))
|
||||
if (QuerySecurityPackageInfoA( (SEC_CHAR *)"Negotiate", &info ))
|
||||
{
|
||||
ok( 0, "Negotiate package not installed, skipping test\n" );
|
||||
return;
|
||||
@@ -396,7 +349,7 @@ START_TEST(negotiate)
|
||||
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 );
|
||||
pFreeContextBuffer( info );
|
||||
FreeContextBuffer( info );
|
||||
|
||||
test_authentication();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static HMODULE secdll, crypt32dll;
|
||||
static HMODULE secdll;
|
||||
|
||||
static ACQUIRE_CREDENTIALS_HANDLE_FN_A pAcquireCredentialsHandleA;
|
||||
static ENUMERATE_SECURITY_PACKAGES_FN_A pEnumerateSecurityPackagesA;
|
||||
@@ -42,16 +42,6 @@ static DELETE_SECURITY_CONTEXT_FN pDeleteSecurityContext;
|
||||
static DECRYPT_MESSAGE_FN pDecryptMessage;
|
||||
static ENCRYPT_MESSAGE_FN pEncryptMessage;
|
||||
|
||||
static PCCERT_CONTEXT (WINAPI *pCertCreateCertificateContext)(DWORD,const BYTE*,DWORD);
|
||||
static BOOL (WINAPI *pCertFreeCertificateContext)(PCCERT_CONTEXT);
|
||||
static BOOL (WINAPI *pCertSetCertificateContextProperty)(PCCERT_CONTEXT,DWORD,DWORD,const void*);
|
||||
static PCCERT_CONTEXT (WINAPI *pCertEnumCertificatesInStore)(HCERTSTORE,PCCERT_CONTEXT);
|
||||
|
||||
static BOOL (WINAPI *pCryptAcquireContextW)(HCRYPTPROV*, LPCWSTR, LPCWSTR, DWORD, DWORD);
|
||||
static BOOL (WINAPI *pCryptDestroyKey)(HCRYPTKEY);
|
||||
static BOOL (WINAPI *pCryptImportKey)(HCRYPTPROV,const BYTE*,DWORD,HCRYPTKEY,DWORD,HCRYPTKEY*);
|
||||
static BOOL (WINAPI *pCryptReleaseContext)(HCRYPTPROV,ULONG_PTR);
|
||||
|
||||
static const BYTE bigCert[] = { 0x30, 0x7a, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06,
|
||||
0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
|
||||
0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x22,
|
||||
@@ -119,13 +109,9 @@ static CHAR unisp_name_a[] = UNISP_NAME_A;
|
||||
|
||||
static void InitFunctionPtrs(void)
|
||||
{
|
||||
HMODULE advapi32dll;
|
||||
|
||||
crypt32dll = LoadLibraryA("crypt32.dll");
|
||||
secdll = LoadLibraryA("secur32.dll");
|
||||
if(!secdll)
|
||||
secdll = LoadLibraryA("security.dll");
|
||||
advapi32dll = LoadLibraryA("advapi32.dll");
|
||||
|
||||
#define GET_PROC(h, func) p ## func = (void*)GetProcAddress(h, #func)
|
||||
|
||||
@@ -143,16 +129,6 @@ static void InitFunctionPtrs(void)
|
||||
GET_PROC(secdll, EncryptMessage);
|
||||
}
|
||||
|
||||
GET_PROC(advapi32dll, CryptAcquireContextW);
|
||||
GET_PROC(advapi32dll, CryptDestroyKey);
|
||||
GET_PROC(advapi32dll, CryptImportKey);
|
||||
GET_PROC(advapi32dll, CryptReleaseContext);
|
||||
|
||||
GET_PROC(crypt32dll, CertFreeCertificateContext);
|
||||
GET_PROC(crypt32dll, CertSetCertificateContextProperty);
|
||||
GET_PROC(crypt32dll, CertCreateCertificateContext);
|
||||
GET_PROC(crypt32dll, CertEnumCertificatesInStore);
|
||||
|
||||
#undef GET_PROC
|
||||
}
|
||||
|
||||
@@ -336,9 +312,9 @@ static void testAcquireSecurityContext(void)
|
||||
HCRYPTKEY key;
|
||||
CRYPT_KEY_PROV_INFO keyProvInfo;
|
||||
|
||||
if (!pAcquireCredentialsHandleA || !pCertCreateCertificateContext ||
|
||||
if (!pAcquireCredentialsHandleA ||
|
||||
!pEnumerateSecurityPackagesA || !pFreeContextBuffer ||
|
||||
!pFreeCredentialsHandle || !pCryptAcquireContextW)
|
||||
!pFreeCredentialsHandle)
|
||||
{
|
||||
win_skip("Needed functions are not available\n");
|
||||
return;
|
||||
@@ -372,13 +348,11 @@ static void testAcquireSecurityContext(void)
|
||||
keyProvInfo.rgProvParam = NULL;
|
||||
keyProvInfo.dwKeySpec = AT_SIGNATURE;
|
||||
|
||||
certs[0] = pCertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
|
||||
sizeof(bigCert));
|
||||
certs[1] = pCertCreateCertificateContext(X509_ASN_ENCODING, selfSignedCert,
|
||||
sizeof(selfSignedCert));
|
||||
certs[0] = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert, sizeof(bigCert));
|
||||
certs[1] = CertCreateCertificateContext(X509_ASN_ENCODING, selfSignedCert, sizeof(selfSignedCert));
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
|
||||
ret = CryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
|
||||
CRYPT_DELETEKEYSET);
|
||||
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||
{
|
||||
@@ -497,31 +471,26 @@ static void testAcquireSecurityContext(void)
|
||||
"or SEC_E_INTERNAL_ERROR, got %08x\n", st);
|
||||
|
||||
/* Good cert, with CRYPT_KEY_PROV_INFO set before it's had a key loaded. */
|
||||
if (pCertSetCertificateContextProperty)
|
||||
{
|
||||
ret = pCertSetCertificateContextProperty(certs[1],
|
||||
CERT_KEY_PROV_INFO_PROP_ID, 0, &keyProvInfo);
|
||||
schanCred.dwVersion = SCH_CRED_V3;
|
||||
ok(ret, "CertSetCertificateContextProperty failed: %08x\n", GetLastError());
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_INTERNAL_ERROR /* WinNT */,
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_INTERNAL_ERROR, got %08x\n", st);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_INTERNAL_ERROR /* WinNT */,
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_INTERNAL_ERROR, got %08x\n", st);
|
||||
}
|
||||
ret = CertSetCertificateContextProperty(certs[1],
|
||||
CERT_KEY_PROV_INFO_PROP_ID, 0, &keyProvInfo);
|
||||
schanCred.dwVersion = SCH_CRED_V3;
|
||||
ok(ret, "CertSetCertificateContextProperty failed: %08x\n", GetLastError());
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_INTERNAL_ERROR /* WinNT */,
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_INTERNAL_ERROR, got %08x\n", st);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_INTERNAL_ERROR /* WinNT */,
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_INTERNAL_ERROR, got %08x\n", st);
|
||||
|
||||
ret = pCryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
|
||||
ret = CryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
|
||||
CRYPT_NEWKEYSET);
|
||||
ok(ret, "CryptAcquireContextW failed: %08x\n", GetLastError());
|
||||
ret = 0;
|
||||
if (pCryptImportKey)
|
||||
{
|
||||
ret = pCryptImportKey(csp, privKey, sizeof(privKey), 0, 0, &key);
|
||||
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
|
||||
}
|
||||
|
||||
ret = CryptImportKey(csp, privKey, sizeof(privKey), 0, 0, &key);
|
||||
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
PCCERT_CONTEXT tmp;
|
||||
@@ -610,20 +579,14 @@ static void testAcquireSecurityContext(void)
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
|
||||
/* FIXME: what about two valid certs? */
|
||||
|
||||
if (pCryptDestroyKey)
|
||||
pCryptDestroyKey(key);
|
||||
CryptDestroyKey(key);
|
||||
}
|
||||
|
||||
if (pCryptReleaseContext)
|
||||
pCryptReleaseContext(csp, 0);
|
||||
pCryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
|
||||
CRYPT_DELETEKEYSET);
|
||||
CryptReleaseContext(csp, 0);
|
||||
CryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL, CRYPT_DELETEKEYSET);
|
||||
|
||||
if (pCertFreeCertificateContext)
|
||||
{
|
||||
pCertFreeCertificateContext(certs[0]);
|
||||
pCertFreeCertificateContext(certs[1]);
|
||||
}
|
||||
CertFreeCertificateContext(certs[0]);
|
||||
CertFreeCertificateContext(certs[1]);
|
||||
}
|
||||
|
||||
static void test_remote_cert(PCCERT_CONTEXT remote_cert)
|
||||
@@ -634,7 +597,7 @@ static void test_remote_cert(PCCERT_CONTEXT remote_cert)
|
||||
|
||||
ok(remote_cert->hCertStore != NULL, "hCertStore == NULL\n");
|
||||
|
||||
while((iter = pCertEnumCertificatesInStore(remote_cert->hCertStore, iter))) {
|
||||
while((iter = CertEnumCertificatesInStore(remote_cert->hCertStore, iter))) {
|
||||
if(iter == remote_cert)
|
||||
incl_remote = TRUE;
|
||||
cert_cnt++;
|
||||
@@ -927,7 +890,7 @@ todo_wine
|
||||
ok(status == SEC_E_OK, "QueryContextAttributesW(SECPKG_ATTR_REMOTE_CERT_CONTEXT) failed: %08x\n", status);
|
||||
if(status == SEC_E_OK) {
|
||||
test_remote_cert(cert);
|
||||
pCertFreeCertificateContext(cert);
|
||||
CertFreeCertificateContext(cert);
|
||||
}
|
||||
|
||||
status = pQueryContextAttributesA(&context, SECPKG_ATTR_CONNECTION_INFO, (void*)&conn_info);
|
||||
@@ -1032,6 +995,4 @@ START_TEST(schannel)
|
||||
|
||||
if(secdll)
|
||||
FreeLibrary(secdll);
|
||||
if(crypt32dll)
|
||||
FreeLibrary(crypt32dll);
|
||||
}
|
||||
|
||||
@@ -315,6 +315,55 @@ static void test_SspiEncodeStringsAsAuthIdentity(void)
|
||||
pSspiFreeAuthIdentity( id );
|
||||
}
|
||||
|
||||
static void test_kerberos(void)
|
||||
{
|
||||
SecPkgInfoA *info;
|
||||
TimeStamp ttl;
|
||||
CredHandle cred;
|
||||
SECURITY_STATUS status;
|
||||
|
||||
SEC_CHAR provider[] = {'K','e','r','b','e','r','o','s',0};
|
||||
|
||||
static const ULONG expected_flags =
|
||||
SECPKG_FLAG_INTEGRITY
|
||||
| SECPKG_FLAG_PRIVACY
|
||||
| SECPKG_FLAG_TOKEN_ONLY
|
||||
| SECPKG_FLAG_DATAGRAM
|
||||
| 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
|
||||
| SECPKG_FLAG_MUTUAL_AUTH
|
||||
| SECPKG_FLAG_DELEGATION
|
||||
| SECPKG_FLAG_READONLY_WITH_CHECKSUM;
|
||||
static const ULONG optional_mask =
|
||||
SECPKG_FLAG_RESTRICTED_TOKENS
|
||||
| SECPKG_FLAG_APPCONTAINER_CHECKS;
|
||||
|
||||
status = QuerySecurityPackageInfoA(provider, &info);
|
||||
ok(status == SEC_E_OK, "Kerberos package not installed, skipping test\n");
|
||||
if(status != SEC_E_OK)
|
||||
return;
|
||||
|
||||
ok( (info->fCapabilities & ~optional_mask) == expected_flags, "got %08x, expected %08x\n", info->fCapabilities, expected_flags );
|
||||
ok( info->wVersion == 1, "got %u\n", info->wVersion );
|
||||
ok( info->wRPCID == RPC_C_AUTHN_GSS_KERBEROS, "got %u\n", info->wRPCID );
|
||||
ok( info->cbMaxToken >= 12000, "got %u\n", info->cbMaxToken );
|
||||
ok( !lstrcmpA( info->Name, "Kerberos" ), "got %s\n", info->Name );
|
||||
ok( !lstrcmpA( info->Comment, "Microsoft Kerberos V1.0" ), "got %s\n", info->Comment );
|
||||
FreeContextBuffer( info );
|
||||
|
||||
status = AcquireCredentialsHandleA( NULL, provider, SECPKG_CRED_OUTBOUND, NULL,
|
||||
NULL, NULL, NULL, &cred, &ttl );
|
||||
todo_wine ok( status == SEC_E_OK, "AcquireCredentialsHandleA returned %08x\n", status );
|
||||
if(status == SEC_E_OK)
|
||||
FreeCredentialHandle( &cred );
|
||||
}
|
||||
|
||||
START_TEST(secur32)
|
||||
{
|
||||
secdll = LoadLibraryA("secur32.dll");
|
||||
@@ -361,4 +410,6 @@ START_TEST(secur32)
|
||||
|
||||
FreeLibrary(secdll);
|
||||
}
|
||||
|
||||
test_kerberos();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user