1b2a80cabc
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@1437 6952d904-891a-0410-993b-d76249ca496b
141 lines
4.6 KiB
Diff
141 lines
4.6 KiB
Diff
diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c
|
|
index cf3c8eb..c981bf2 100644 (file)
|
|
--- a/dlls/secur32/schannel.c
|
|
+++ b/dlls/secur32/schannel.c
|
|
@@ -653,128 +653,17 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW(
|
|
PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
|
|
PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
|
|
{
|
|
- struct schan_context *ctx;
|
|
- struct schan_buffers *out_buffers;
|
|
- struct schan_credentials *cred;
|
|
- struct schan_transport transport;
|
|
- int err;
|
|
-
|
|
- TRACE("%p %p %s %d %d %d %p %d %p %p %p %p\n", phCredential, phContext,
|
|
- debugstr_w(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
|
|
- Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
|
-
|
|
- dump_buffer_desc(pInput);
|
|
- dump_buffer_desc(pOutput);
|
|
-
|
|
- if (!phContext)
|
|
+ SECURITY_STATUS ret;
|
|
+ if (phCredential)
|
|
{
|
|
- ULONG_PTR handle;
|
|
-
|
|
- if (!phCredential) return SEC_E_INVALID_HANDLE;
|
|
-
|
|
- cred = schan_get_object(phCredential->dwLower, SCHAN_HANDLE_CRED);
|
|
- if (!cred) return SEC_E_INVALID_HANDLE;
|
|
-
|
|
- if (!(cred->credential_use & SECPKG_CRED_OUTBOUND))
|
|
- {
|
|
- WARN("Invalid credential use %#x\n", cred->credential_use);
|
|
- return SEC_E_INVALID_HANDLE;
|
|
- }
|
|
-
|
|
- ctx = HeapAlloc(GetProcessHeap(), 0, sizeof(*ctx));
|
|
- if (!ctx) return SEC_E_INSUFFICIENT_MEMORY;
|
|
-
|
|
- handle = schan_alloc_handle(ctx, SCHAN_HANDLE_CTX);
|
|
- if (handle == SCHAN_INVALID_HANDLE)
|
|
- {
|
|
- HeapFree(GetProcessHeap(), 0, ctx);
|
|
- return SEC_E_INTERNAL_ERROR;
|
|
- }
|
|
-
|
|
- err = pgnutls_init(&ctx->session, GNUTLS_CLIENT);
|
|
- if (err != GNUTLS_E_SUCCESS)
|
|
- {
|
|
- pgnutls_perror(err);
|
|
- schan_free_handle(handle, SCHAN_HANDLE_CTX);
|
|
- HeapFree(GetProcessHeap(), 0, ctx);
|
|
- return SEC_E_INTERNAL_ERROR;
|
|
- }
|
|
-
|
|
- /* FIXME: We should be using the information from the credentials here. */
|
|
- FIXME("Using hardcoded \"NORMAL\" priority\n");
|
|
- err = pgnutls_set_default_priority(ctx->session);
|
|
- if (err != GNUTLS_E_SUCCESS)
|
|
- {
|
|
- pgnutls_perror(err);
|
|
- pgnutls_deinit(ctx->session);
|
|
- schan_free_handle(handle, SCHAN_HANDLE_CTX);
|
|
- HeapFree(GetProcessHeap(), 0, ctx);
|
|
- }
|
|
-
|
|
- err = pgnutls_credentials_set(ctx->session, GNUTLS_CRD_CERTIFICATE, cred->credentials);
|
|
- if (err != GNUTLS_E_SUCCESS)
|
|
- {
|
|
- pgnutls_perror(err);
|
|
- pgnutls_deinit(ctx->session);
|
|
- schan_free_handle(handle, SCHAN_HANDLE_CTX);
|
|
- HeapFree(GetProcessHeap(), 0, ctx);
|
|
- }
|
|
-
|
|
- pgnutls_transport_set_pull_function(ctx->session, schan_pull);
|
|
- pgnutls_transport_set_push_function(ctx->session, schan_push);
|
|
-
|
|
- phNewContext->dwLower = handle;
|
|
- phNewContext->dwUpper = 0;
|
|
+ FIXME("stub\n");
|
|
+ ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
}
|
|
else
|
|
{
|
|
- ctx = schan_get_object(phContext->dwLower, SCHAN_HANDLE_CTX);
|
|
- }
|
|
-
|
|
- ctx->req_ctx_attr = fContextReq;
|
|
-
|
|
- transport.ctx = ctx;
|
|
- init_schan_buffers(&transport.in, pInput, schan_init_sec_ctx_get_next_buffer);
|
|
- init_schan_buffers(&transport.out, pOutput, schan_init_sec_ctx_get_next_buffer);
|
|
- pgnutls_transport_set_ptr(ctx->session, &transport);
|
|
-
|
|
- /* Perform the TLS handshake */
|
|
- err = pgnutls_handshake(ctx->session);
|
|
-
|
|
- out_buffers = &transport.out;
|
|
- if (out_buffers->current_buffer_idx != -1)
|
|
- {
|
|
- SecBuffer *buffer = &out_buffers->desc->pBuffers[out_buffers->current_buffer_idx];
|
|
- buffer->cbBuffer = out_buffers->offset;
|
|
- }
|
|
-
|
|
- *pfContextAttr = 0;
|
|
- if (ctx->req_ctx_attr & ISC_REQ_ALLOCATE_MEMORY)
|
|
- *pfContextAttr |= ISC_RET_ALLOCATED_MEMORY;
|
|
-
|
|
- switch(err)
|
|
- {
|
|
- case GNUTLS_E_SUCCESS:
|
|
- TRACE("Handshake completed\n");
|
|
- return SEC_E_OK;
|
|
-
|
|
- case GNUTLS_E_AGAIN:
|
|
- TRACE("Continue...\n");
|
|
- return SEC_I_CONTINUE_NEEDED;
|
|
-
|
|
- case GNUTLS_E_WARNING_ALERT_RECEIVED:
|
|
- case GNUTLS_E_FATAL_ALERT_RECEIVED:
|
|
- {
|
|
- gnutls_alert_description_t alert = pgnutls_alert_get(ctx->session);
|
|
- const char *alert_name = pgnutls_alert_get_name(alert);
|
|
- WARN("ALERT: %d %s\n", alert, alert_name);
|
|
- return SEC_E_INTERNAL_ERROR;
|
|
- }
|
|
-
|
|
- default:
|
|
- pgnutls_perror(err);
|
|
- return SEC_E_INTERNAL_ERROR;
|
|
+ ret = SEC_E_INVALID_HANDLE;
|
|
}
|
|
+ return ret;
|
|
}
|
|
|
|
/***********************************************************************
|
|
|